Prevent crash

pull/196/head
M66B 4 years ago
parent d0615fd488
commit e322d4f8bc

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

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

Loading…
Cancel
Save