Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pre-launch report: Your use of exact alarms is causing your app to crash for some Android users #112

Open
mustafa0x opened this issue Nov 15, 2024 · 1 comment

Comments

@mustafa0x
Copy link

mustafa0x commented Nov 15, 2024

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.

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.

@mustafa0x
Copy link
Author

Update, the ACTION_REQUEST_SCHEDULE_EXACT_ALARM must be invoked to get this permission.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant