Предупреждение SCHEDULE_EXACT_ALARM, несмотря на то, что оно не запланировано ⇐ Android
Предупреждение SCHEDULE_EXACT_ALARM, несмотря на то, что оно не запланировано
I see the following warning in PlayStore:
Your use of exact alarms is causing your app to crash for some Android users Your app schedules exact alarms without checking whether the SCHEDULE_EXACT_ALARM permission has been granted. This is causing your app to crash for users on Android 14 because the permission is no longer granted by default. In most cases, alternative methods of scheduling work or inexact alarms are more appropriate. If your use of exact alarms is justified, update your app so that it checks this permission is granted before scheduling. Although, I very specifically only trigger an INEXACT alarm in the following manner:
val alarmManager = context.getSystemService(Context.ALARM_SERVICE) as AlarmManager val alarmIntent = Intent(context, MediaDownloadAlarmReceiver::class.java).let { intent -> PendingIntent.getBroadcast( context, 0, intent, PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT) } val calendar = Calendar.getInstance().apply { timeInMillis = System.currentTimeMillis() set(Calendar.HOUR_OF_DAY, 5) set(Calendar.MINUTE, 0) } // Set the alarm to start at approximately 5:00 a.m. alarmManager.setInexactRepeating( AlarmManager.RTC_WAKEUP, calendar.timeInMillis, AlarmManager.INTERVAL_DAY, alarmIntent) Once the alarm triggers, I schedule a one time worker request:
override fun onReceive(context: Context?, intent: Intent?) { if (context != null) { MediaDownloadWorker.scheduleOneTimeRequest( context = context, source = "background_process") } } Any idea what am I missing?
Источник: https://stackoverflow.com/questions/781 ... eduling-it
I see the following warning in PlayStore:
Your use of exact alarms is causing your app to crash for some Android users Your app schedules exact alarms without checking whether the SCHEDULE_EXACT_ALARM permission has been granted. This is causing your app to crash for users on Android 14 because the permission is no longer granted by default. In most cases, alternative methods of scheduling work or inexact alarms are more appropriate. If your use of exact alarms is justified, update your app so that it checks this permission is granted before scheduling. Although, I very specifically only trigger an INEXACT alarm in the following manner:
val alarmManager = context.getSystemService(Context.ALARM_SERVICE) as AlarmManager val alarmIntent = Intent(context, MediaDownloadAlarmReceiver::class.java).let { intent -> PendingIntent.getBroadcast( context, 0, intent, PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT) } val calendar = Calendar.getInstance().apply { timeInMillis = System.currentTimeMillis() set(Calendar.HOUR_OF_DAY, 5) set(Calendar.MINUTE, 0) } // Set the alarm to start at approximately 5:00 a.m. alarmManager.setInexactRepeating( AlarmManager.RTC_WAKEUP, calendar.timeInMillis, AlarmManager.INTERVAL_DAY, alarmIntent) Once the alarm triggers, I schedule a one time worker request:
override fun onReceive(context: Context?, intent: Intent?) { if (context != null) { MediaDownloadWorker.scheduleOneTimeRequest( context = context, source = "background_process") } } Any idea what am I missing?
Источник: https://stackoverflow.com/questions/781 ... eduling-it
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
Приложение Expo запланировано сразу же запускаемые уведомления, а не запланированное
Anonymous » » в форуме Android - 0 Ответы
- 27 Просмотры
-
Последнее сообщение Anonymous
-
-
-
Приложение Expo запланировано сразу же запускаемые уведомления, а не запланированное
Anonymous » » в форуме Android - 0 Ответы
- 24 Просмотры
-
Последнее сообщение Anonymous
-