mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
Fix ForegroundServiceStartNotAllowedException in FetchForegroundService.onCreate
Co-authored-by: adbenitez <24558636+adbenitez@users.noreply.github.com>
This commit is contained in:
@@ -88,7 +88,13 @@ public final class FetchForegroundService extends Service {
|
||||
.setSmallIcon(R.drawable.notification_permanent)
|
||||
.build();
|
||||
|
||||
startForeground(NotificationCenter.ID_FETCH, notification);
|
||||
try {
|
||||
startForeground(NotificationCenter.ID_FETCH, notification);
|
||||
} catch (Exception e) {
|
||||
Log.w(TAG, "Failed to start foreground service: " + e);
|
||||
stopSelf();
|
||||
return;
|
||||
}
|
||||
|
||||
Util.runOnAnyBackgroundThread(() -> {
|
||||
Log.i(TAG, "Starting fetch");
|
||||
|
||||
Reference in New Issue
Block a user