diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/extensions/Context.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/extensions/Context.kt index 718629c7..f40fb39e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/extensions/Context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/extensions/Context.kt @@ -48,7 +48,11 @@ fun Context.scheduleNextAutomaticBackup() { val pendingIntent = getAutomaticBackupIntent() val alarmManager = getSystemService(Context.ALARM_SERVICE) as AlarmManager try { - AlarmManagerCompat.setExactAndAllowWhileIdle(alarmManager, AlarmManager.RTC_WAKEUP, backupAtMillis, pendingIntent) + if (isUpsideDownCakePlus() && alarmManager.canScheduleExactAlarms()) { + AlarmManagerCompat.setExactAndAllowWhileIdle(alarmManager, AlarmManager.RTC_WAKEUP, backupAtMillis, pendingIntent) + } else { + AlarmManagerCompat.setAndAllowWhileIdle(alarmManager, AlarmManager.RTC_WAKEUP, backupAtMillis, pendingIntent) + } } catch (e: Exception) { showErrorToast(e) } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index fce02cb5..b9cb7aaf 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -14,7 +14,7 @@ indicatorfastscroll = "4524cd0b61" #Room room = "2.6.0-alpha02" #Simple tools -simple-commons = "c5a32fb1f3" +simple-commons = "d1629c7f1a" #Gradle gradlePlugins-agp = "8.1.0" #build