2
0
mirror of https://github.com/KDE/kdeconnect-android synced 2025-08-22 18:07:55 +00:00

startService throws if called when the app is in the background in Oreo

This commit is contained in:
Albert Vaca 2018-10-28 12:19:01 +01:00
parent be6b108e64
commit 24e1a95e92

View File

@ -399,7 +399,11 @@ public class BackgroundService extends Service {
}
}
Intent serviceIntent = new Intent(c, BackgroundService.class);
c.startService(serviceIntent);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
c.startForegroundService(serviceIntent);
} else {
c.startService(serviceIntent);
}
}).start();
}