-
Notifications
You must be signed in to change notification settings - Fork 34
Description
I submitted my app to the Play Store, and it was rejected due to crashing. The cause:
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.
I checked the official docs. They say check canScheduleExactAlarms() first. However the code seems to indeed do so.
Lines 192 to 194 in c290f3c
| if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S && !alarmManager.canScheduleExactAlarms()) { | |
| if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { | |
| alarmManager.setAndAllowWhileIdle(AlarmManager.RTC_WAKEUP, request.scheduleAt.time, pendingIntent); |
I have added <uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />
to AndroidManifest.xml, as specified in the docs.