From baacc9f1e2266247db6fdc11eeadc711c2dcd342 Mon Sep 17 00:00:00 2001 From: Paul Date: Mon, 6 Jan 2025 20:16:24 +0100 Subject: [PATCH] fix service killed by Android battery saver having an always-on/ongoing notification is required in order for Android not to kill it --- .../main/java/me/kavishdevar/aln/services/AirPodsService.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/android/app/src/main/java/me/kavishdevar/aln/services/AirPodsService.kt b/android/app/src/main/java/me/kavishdevar/aln/services/AirPodsService.kt index b1efcc1..72db385 100644 --- a/android/app/src/main/java/me/kavishdevar/aln/services/AirPodsService.kt +++ b/android/app/src/main/java/me/kavishdevar/aln/services/AirPodsService.kt @@ -151,6 +151,7 @@ class AirPodsService: Service() { .setContentTitle("AirPods are not connected") .setCategory(Notification.CATEGORY_SERVICE) .setPriority(NotificationCompat.PRIORITY_LOW) + .setOngoing(true) .build() try { @@ -281,6 +282,7 @@ class AirPodsService: Service() { } ?: ""}""") .setCategory(Notification.CATEGORY_SERVICE) .setPriority(NotificationCompat.PRIORITY_LOW) + .setOngoing(true) .build() } else { @@ -289,6 +291,7 @@ class AirPodsService: Service() { .setContentTitle("AirPods are not connected") .setCategory(Notification.CATEGORY_SERVICE) .setPriority(NotificationCompat.PRIORITY_LOW) + .setOngoing(true) .build() }