mirror of
https://github.com/kavishdevar/librepods.git
synced 2026-03-25 15:35:27 +00:00
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:
@@ -151,6 +151,7 @@ class AirPodsService: Service() {
|
|||||||
.setContentTitle("AirPods are not connected")
|
.setContentTitle("AirPods are not connected")
|
||||||
.setCategory(Notification.CATEGORY_SERVICE)
|
.setCategory(Notification.CATEGORY_SERVICE)
|
||||||
.setPriority(NotificationCompat.PRIORITY_LOW)
|
.setPriority(NotificationCompat.PRIORITY_LOW)
|
||||||
|
.setOngoing(true)
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -281,6 +282,7 @@ class AirPodsService: Service() {
|
|||||||
} ?: ""}""")
|
} ?: ""}""")
|
||||||
.setCategory(Notification.CATEGORY_SERVICE)
|
.setCategory(Notification.CATEGORY_SERVICE)
|
||||||
.setPriority(NotificationCompat.PRIORITY_LOW)
|
.setPriority(NotificationCompat.PRIORITY_LOW)
|
||||||
|
.setOngoing(true)
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -289,6 +291,7 @@ class AirPodsService: Service() {
|
|||||||
.setContentTitle("AirPods are not connected")
|
.setContentTitle("AirPods are not connected")
|
||||||
.setCategory(Notification.CATEGORY_SERVICE)
|
.setCategory(Notification.CATEGORY_SERVICE)
|
||||||
.setPriority(NotificationCompat.PRIORITY_LOW)
|
.setPriority(NotificationCompat.PRIORITY_LOW)
|
||||||
|
.setOngoing(true)
|
||||||
.build()
|
.build()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user