Enable wakelock by default
This commit is contained in:
parent
ff6ecd5524
commit
ba4ae0899f
3 changed files with 5 additions and 7 deletions
|
@ -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) {
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -173,9 +173,9 @@
|
|||
<string name="settings_unified_push_base_url_default_summary">%1$s (default)</string>
|
||||
<string name="settings_advanced_header">Advanced</string>
|
||||
<string name="settings_advanced_wakelock_key">WakelockEnabled</string>
|
||||
<string name="settings_advanced_wakelock_title">Permanent wakelock (needed for some devices)</string>
|
||||
<string name="settings_advanced_wakelock_summary_enabled">Higher battery usage but should always wake up</string>
|
||||
<string name="settings_advanced_wakelock_summary_disabled">Minimal battery drain, some devices will not wake up</string>
|
||||
<string name="settings_advanced_wakelock_title">Permanent wakelock</string>
|
||||
<string name="settings_advanced_wakelock_summary_enabled">Prevents app from sleeping to ensure timely notification delivery. This consumes a lot of battery, but some devices require this.</string>
|
||||
<string name="settings_advanced_wakelock_summary_disabled">Allows app to enter sleep mode. This may negatively impact notification delivery. It depends on the device.</string>
|
||||
<string name="settings_advanced_broadcast_key">BroadcastEnabled</string>
|
||||
<string name="settings_advanced_broadcast_title">Broadcast messages</string>
|
||||
<string name="settings_advanced_broadcast_summary_enabled">Apps can receive incoming notifications as broadcasts</string>
|
||||
|
|
Loading…
Reference in a new issue