catch run time exception when starting service from event receiver

This commit is contained in:
Daniel Gultsch 2018-04-20 10:51:00 +02:00
parent 7f7b7fca0b
commit 9a36627e67
1 changed files with 5 additions and 1 deletions

View File

@ -24,7 +24,11 @@ public class EventReceiver extends BroadcastReceiver {
} }
final String action = intent.getAction(); final String action = intent.getAction();
if (action.equals("ui") || hasEnabledAccounts(context)) { if (action.equals("ui") || hasEnabledAccounts(context)) {
context.startService(mIntentForService); try {
context.startService(mIntentForService);
} catch (RuntimeException e) {
Log.d(Config.LOGTAG,"EventReceiver was unable to start service");
}
} else { } else {
Log.d(Config.LOGTAG,"EventReceiver ignored action "+mIntentForService.getAction()); Log.d(Config.LOGTAG,"EventReceiver ignored action "+mIntentForService.getAction());
} }