Start foreground not allowed

This commit is contained in:
M66B
2024-04-16 12:39:35 +02:00
parent 96be6d30a1
commit 27e955a13f
3 changed files with 49 additions and 9 deletions

View File

@@ -69,7 +69,14 @@ public class ServiceExternal extends ServiceBase {
public void onCreate() {
Log.i("Service external create");
super.onCreate();
startForeground(NotificationHelper.NOTIFICATION_EXTERNAL, getNotification());
try {
startForeground(NotificationHelper.NOTIFICATION_EXTERNAL, getNotification());
} catch (Throwable ex) {
if (Helper.isPlayStoreInstall())
Log.i(ex);
else
Log.e(ex);
}
}
@Override
@@ -92,7 +99,14 @@ public class ServiceExternal extends ServiceBase {
Log.logExtras(intent);
super.onStartCommand(intent, flags, startId);
startForeground(NotificationHelper.NOTIFICATION_EXTERNAL, getNotification());
try {
startForeground(NotificationHelper.NOTIFICATION_EXTERNAL, getNotification());
} catch (Throwable ex) {
if (Helper.isPlayStoreInstall())
Log.i(ex);
else
Log.e(ex);
}
if (intent == null)
return START_NOT_STICKY;