package net.celltron.node
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.os.Build
/** Start the node service on device boot, so the pgh stack survives reboots. */
class BootReceiver : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
if (intent.action == Intent.ACTION_BOOT_COMPLETED) {
val i = Intent(context, PghNodeService::class.java)
if (Build.VERSION.SDK_INT >= 26) {
context.startForegroundService(i)
} else {
context.startService(i)
}
}
}
}