diff --git a/app/core/src/main/java/com/fsck/k9/controller/push/PushService.kt b/app/core/src/main/java/com/fsck/k9/controller/push/PushService.kt index 90c9fe33a6a6e15f3d3d00e70233b21a18af6626..a24baf9de16b18ca8853ec832128b9e89629e3e5 100644 --- a/app/core/src/main/java/com/fsck/k9/controller/push/PushService.kt +++ b/app/core/src/main/java/com/fsck/k9/controller/push/PushService.kt @@ -25,7 +25,7 @@ class PushService : Service() { Timber.v("PushService.onStartCommand()") super.onStartCommand(intent, flags, startId) - startForeground() + // startForeground() initializePushController() return START_STICKY @@ -42,7 +42,7 @@ class PushService : Service() { val notification = pushNotificationManager.createForegroundNotification() if (Build.VERSION.SDK_INT >= 29) { - startForeground(notificationId, notification, ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC) + startForeground(notificationId, notification, ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC) } else { startForeground(notificationId, notification) } diff --git a/app/core/src/main/java/com/fsck/k9/controller/push/PushServiceManager.kt b/app/core/src/main/java/com/fsck/k9/controller/push/PushServiceManager.kt index 41df5b710e7b7c0a6f3f505bc67d92a4fd924714..e55bf3ee4a1a38af33ea64b86093fbbecb69a6d2 100644 --- a/app/core/src/main/java/com/fsck/k9/controller/push/PushServiceManager.kt +++ b/app/core/src/main/java/com/fsck/k9/controller/push/PushServiceManager.kt @@ -34,7 +34,8 @@ internal class PushServiceManager(private val context: Context) { try { val intent = Intent(context, PushService::class.java) if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - context.startForegroundService(intent) + // context.startForegroundService(intent) + context.startService(intent) } else { context.startService(intent) } diff --git a/app/core/src/main/java/com/fsck/k9/notification/PushNotificationManager.kt b/app/core/src/main/java/com/fsck/k9/notification/PushNotificationManager.kt index bd15f47801b7afb7f7d57bbed2db8af025e83ee0..79b25a37356ae0d75f5a20b77921a54b812810bd 100644 --- a/app/core/src/main/java/com/fsck/k9/notification/PushNotificationManager.kt +++ b/app/core/src/main/java/com/fsck/k9/notification/PushNotificationManager.kt @@ -45,7 +45,9 @@ internal class PushNotificationManager( private fun updateNotification() { val notification = createNotification() - notificationManager.notify(notificationId, notification) + if (notification != null) { + notificationManager.notify(notificationId, notification) + } } private fun createNotification(): Notification {