Swallow potential foreground service crash.

This commit is contained in:
Greyson Parrelli
2025-02-20 10:39:00 -05:00
parent 886bebb088
commit dc78d841c1

View File

@@ -123,7 +123,11 @@ class FcmFetchForegroundService : Service() {
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int { override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
Log.d(TAG, "onStartCommand()") Log.d(TAG, "onStartCommand()")
try {
postForegroundNotification() postForegroundNotification()
} catch (e: RuntimeException) {
Log.w(TAG, "Failed to start foreground service! StopSelf: ${intent?.getBooleanExtra(KEY_STOP_SELF, false)}", e)
}
return if (intent != null && intent.getBooleanExtra(KEY_STOP_SELF, false)) { return if (intent != null && intent.getBooleanExtra(KEY_STOP_SELF, false)) {
WakeLockUtil.release(wakeLock, WAKELOCK_TAG) WakeLockUtil.release(wakeLock, WAKELOCK_TAG)