fix service killed by Android battery saver

having an always-on/ongoing notification is required in order for Android not to kill it
This commit is contained in:
Paul
2025-01-06 20:16:24 +01:00
parent 416ae1e974
commit baacc9f1e2

View File

@@ -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()
}