add a short wakelock at creating the reminder

This commit is contained in:
tibbi 2017-11-13 12:02:53 +01:00
parent 5c33927754
commit 33d9f02cc7
2 changed files with 6 additions and 0 deletions

View File

@ -10,6 +10,7 @@
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.READ_CALENDAR"/>
<uses-permission android:name="android.permission.WRITE_CALENDAR"/>
<uses-permission android:name='android.permission.WAKE_LOCK'/>
<uses-permission
android:name="android.permission.USE_FINGERPRINT"
tools:node="remove"/>

View File

@ -3,6 +3,7 @@ package com.simplemobiletools.calendar.receivers
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.os.PowerManager
import com.simplemobiletools.calendar.extensions.dbHelper
import com.simplemobiletools.calendar.extensions.notifyEvent
import com.simplemobiletools.calendar.extensions.scheduleAllEvents
@ -12,6 +13,10 @@ import com.simplemobiletools.calendar.helpers.Formatter
class NotificationReceiver : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
val powerManager = context.getSystemService(Context.POWER_SERVICE) as PowerManager
val wakelock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "Simple Calendar")
wakelock.acquire(5000)
context.updateListWidget()
val id = intent.getIntExtra(EVENT_ID, -1)
if (id == -1)