Fixed start on boot
This commit is contained in:
@ -27,7 +27,11 @@ public class OnBootReceiver extends BroadcastReceiver implements I2PConstants {
|
|||||||
Intent routerService = new Intent(context, RouterService.class);
|
Intent routerService = new Intent(context, RouterService.class);
|
||||||
// Ticket #2404
|
// Ticket #2404
|
||||||
try {
|
try {
|
||||||
|
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O){
|
||||||
|
context.startForegroundService(routerService);
|
||||||
|
} else {
|
||||||
context.startService(routerService);
|
context.startService(routerService);
|
||||||
|
}
|
||||||
} catch (IllegalStateException ex) {
|
} catch (IllegalStateException ex) {
|
||||||
Util.e("Error: ", ex);
|
Util.e("Error: ", ex);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user