Prevent crash

This commit is contained in:
M66B 2021-03-24 18:55:18 +01:00
parent d0615fd488
commit e322d4f8bc
2 changed files with 10 additions and 3 deletions

View File

@ -753,8 +753,11 @@ public class ServiceSend extends ServiceBase implements SharedPreferences.OnShar
}
static void start(Context context) {
ContextCompat.startForegroundService(context,
new Intent(context, ServiceSend.class));
try {
ContextCompat.startForegroundService(context, new Intent(context, ServiceSend.class));
} catch (Throwable ex) {
Log.e(ex);
}
}
static void schedule(Context context, long delay) {

View File

@ -2433,7 +2433,11 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
if (isBackgroundService(context))
context.startService(intent);
else
ContextCompat.startForegroundService(context, intent);
try {
ContextCompat.startForegroundService(context, intent);
} catch (Throwable ex) {
Log.e(ex);
}
}
private static boolean isBackgroundService(Context context) {