Hopeful fix for crash on API 19.

main
Greyson Parrelli 2022-11-07 11:22:31 -05:00
rodzic 74c542099a
commit f241a51fe1
1 zmienionych plików z 7 dodań i 3 usunięć

Wyświetl plik

@ -178,9 +178,13 @@ public final class GenericForegroundService extends Service {
} else {
try {
ContextCompat.startForegroundService(context, intent);
} catch (ForegroundServiceStartNotAllowedException e) {
Log.e(TAG, "Unable to start foreground service", e);
throw new UnableToStartException(e);
} catch (IllegalStateException e) {
if (e instanceof ForegroundServiceStartNotAllowedException) {
Log.e(TAG, "Unable to start foreground service", e);
throw new UnableToStartException(e);
} else {
throw e;
}
}
}