catch security exceptions thrown at alarm setRepeating
This commit is contained in:
parent
ba70e6b523
commit
f994a085e1
|
@ -278,7 +278,10 @@ fun Context.scheduleCalDAVSync(activate: Boolean) {
|
||||||
|
|
||||||
if (activate) {
|
if (activate) {
|
||||||
val syncCheckInterval = 4 * AlarmManager.INTERVAL_HOUR
|
val syncCheckInterval = 4 * AlarmManager.INTERVAL_HOUR
|
||||||
|
try {
|
||||||
alarm.setRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() + syncCheckInterval, syncCheckInterval, pendingIntent)
|
alarm.setRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() + syncCheckInterval, syncCheckInterval, pendingIntent)
|
||||||
|
} catch (ignored: SecurityException) {
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
alarm.cancel(pendingIntent)
|
alarm.cancel(pendingIntent)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue