From 4cda3d9f8da52663a90fa3a14edbab39bb7f9c0a Mon Sep 17 00:00:00 2001 From: sim Date: Thu, 31 Aug 2023 01:47:08 +0200 Subject: [PATCH] Remove static wakelock --- .../nextpush/receivers/RegisterBroadcastReceiver.kt | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/app/src/main/java/org/unifiedpush/distributor/nextpush/receivers/RegisterBroadcastReceiver.kt b/app/src/main/java/org/unifiedpush/distributor/nextpush/receivers/RegisterBroadcastReceiver.kt index 6c98abe..1601805 100644 --- a/app/src/main/java/org/unifiedpush/distributor/nextpush/receivers/RegisterBroadcastReceiver.kt +++ b/app/src/main/java/org/unifiedpush/distributor/nextpush/receivers/RegisterBroadcastReceiver.kt @@ -36,7 +36,7 @@ class RegisterBroadcastReceiver : BroadcastReceiver() { override fun onReceive(rContext: Context, intent: Intent?) { val context = rContext.applicationContext - wakeLock = (context.getSystemService(Context.POWER_SERVICE) as PowerManager).run { + val wakeLock = (context.getSystemService(Context.POWER_SERVICE) as PowerManager).run { newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, WAKE_LOCK_TAG) } wakeLock?.acquire(30000L /*30 secs*/) @@ -129,8 +129,4 @@ class RegisterBroadcastReceiver : BroadcastReceiver() { list.remove(token) } } - - companion object { - private var wakeLock: PowerManager.WakeLock? = null - } }