Add wakeLock for the registration Receiver

This commit is contained in:
sim 2022-01-14 01:53:58 +01:00
parent 1ab3eaa83a
commit 8db0e41628

View File

@ -11,6 +11,7 @@ import org.unifiedpush.distributor.nextpush.api.createQueue
import org.unifiedpush.distributor.nextpush.api.delQueue
import org.unifiedpush.distributor.nextpush.api.apiCreateApp
import org.unifiedpush.distributor.nextpush.api.apiDeleteApp
import org.unifiedpush.distributor.nextpush.services.wakeLock
import java.lang.Exception
/**
@ -22,6 +23,9 @@ private const val TAG = "RegisterBroadcastReceiver"
class RegisterBroadcastReceiver : BroadcastReceiver() {
override fun onReceive(context: Context?, intent: Intent?) {
wakeLock?.let {
it.acquire()
}
when (intent!!.action) {
ACTION_REGISTER ->{
Log.i(TAG,"REGISTER")
@ -85,5 +89,10 @@ class RegisterBroadcastReceiver : BroadcastReceiver() {
}
}
}
wakeLock?.let {
if (it.isHeld) {
it.release()
}
}
}
}