Hopeful fix for crash on API 19.
This commit is contained in:
parent
74c542099a
commit
f241a51fe1
1 changed files with 7 additions and 3 deletions
|
@ -178,9 +178,13 @@ public final class GenericForegroundService extends Service {
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
ContextCompat.startForegroundService(context, intent);
|
ContextCompat.startForegroundService(context, intent);
|
||||||
} catch (ForegroundServiceStartNotAllowedException e) {
|
} catch (IllegalStateException e) {
|
||||||
Log.e(TAG, "Unable to start foreground service", e);
|
if (e instanceof ForegroundServiceStartNotAllowedException) {
|
||||||
throw new UnableToStartException(e);
|
Log.e(TAG, "Unable to start foreground service", e);
|
||||||
|
throw new UnableToStartException(e);
|
||||||
|
} else {
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue