diff --git a/app/src/main/java/io/heckel/ntfy/data/Repository.kt b/app/src/main/java/io/heckel/ntfy/data/Repository.kt
index 9d714b6..62d5b01 100644
--- a/app/src/main/java/io/heckel/ntfy/data/Repository.kt
+++ b/app/src/main/java/io/heckel/ntfy/data/Repository.kt
@@ -159,7 +159,7 @@ class Repository(private val sharedPrefs: SharedPreferences, private val subscri
}
fun getWakelockEnabled(): Boolean {
- return sharedPrefs.getBoolean(SHARED_PREFS_WAKELOCK_ENABLED, false) // Disabled by default
+ return sharedPrefs.getBoolean(SHARED_PREFS_WAKELOCK_ENABLED, true) // Enabled by default
}
fun setWakelockEnabled(enabled: Boolean) {
diff --git a/app/src/main/java/io/heckel/ntfy/service/SubscriberService.kt b/app/src/main/java/io/heckel/ntfy/service/SubscriberService.kt
index 707971f..cacee8a 100644
--- a/app/src/main/java/io/heckel/ntfy/service/SubscriberService.kt
+++ b/app/src/main/java/io/heckel/ntfy/service/SubscriberService.kt
@@ -205,9 +205,7 @@ class SubscriberService : Service() {
// If permanent wakelock is not enabled, still take the wakelock while notifications are being dispatched
if (!repository.getWakelockEnabled()) {
// Wakelocks are reference counted by default so that should work neatly here
- wakeLock?.let {
- it.acquire()
- }
+ wakeLock?.acquire(10*60*1000L /*10 minutes*/)
}
val url = topicUrl(subscription.baseUrl, subscription.topic)
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 276c1af..5f9d5b4 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -173,9 +173,9 @@
%1$s (default)
Advanced
WakelockEnabled
- Permanent wakelock (needed for some devices)
- Higher battery usage but should always wake up
- Minimal battery drain, some devices will not wake up
+ Permanent wakelock
+ Prevents app from sleeping to ensure timely notification delivery. This consumes a lot of battery, but some devices require this.
+ Allows app to enter sleep mode. This may negatively impact notification delivery. It depends on the device.
BroadcastEnabled
Broadcast messages
Apps can receive incoming notifications as broadcasts