catch security exceptions thrown at alarm setRepeating

This commit is contained in:
tibbi 2018-01-31 21:24:25 +01:00
parent ba70e6b523
commit f994a085e1
1 changed files with 4 additions and 1 deletions

View File

@ -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
alarm.setRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() + syncCheckInterval, syncCheckInterval, pendingIntent) try {
alarm.setRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() + syncCheckInterval, syncCheckInterval, pendingIntent)
} catch (ignored: SecurityException) {
}
} else { } else {
alarm.cancel(pendingIntent) alarm.cancel(pendingIntent)
} }