Search code examples
androidreact-nativeandroid-permissionsgoogle-developers-console

When app need: SCHEDULE_EXACT_ALARM and USE_EXACT_ALARM android permissions


In app manifest I have:

<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM"/>
<uses-permission android:name="android.permission.USE_EXACT_ALARM"/>

But google now asks me to set if app is calendar or alarm app.
But this app is not any of these.
I think it was added because you can start something in the app and local notification is scheduled to fire notification at specified time 5 min before times out and when something times out.

  • In this situation are those permissions required?

  • And how to deploy app now to remove these permissions when google doesn't allow me to deploy build?

And because this is already on the store I can't just remove and upload but I don't want to categorize app as alarm or calendar but now I can't deploy changes.

UPDATE

I removed both permission but can't deploy as I am still getting error:

Google Api Error: Invalid request - You must let us know whether your app uses any exact alarm permissions


Solution

  • As per new android 14 update Schedule exact alarms are denied by default.


    As Google says :

    Exact alarms are meant for user-intentioned notifications or actions that need to happen at a precise time.

    SCHEDULE_EXACT_ALARM is only intended for use by apps that rely on exact alarms for their core functionality.

    Being sensitive permission, app stores enforces policies to audit/review the use of this permission. May involve removal from the app store if they found you to be misusing permission.

    Exact alarm should be used only if you are using any set*exact* method to trigger an alarm at exact specified date-time. Otherwise "schedule" methods are enough, letting system choose proper nearest date-time to trigger alarm accordingly to system factors.


    SCHEDULE_EXACT_ALARM, the permission introduced in Android 12 for apps to schedule exact alarms, is no longer being pre-granted to most newly installed apps targeting Android 13 and higher (will be set to denied by default).

    In reference from .

    Calendar or alarm clock apps need to send calendar reminders, wake-up alarms, or alerts when the app is no longer running. These apps can request the USE_EXACT_ALARM normal permission. The USE_EXACT_ALARM permission will be granted on install, and apps holding this permission will be able to schedule exact alarms just like apps with the SCHEDULE_EXACT_ALARM permission.

    What you can do

    Check the usage of following functions :

    1. setExact()

    2. setExactAndAllowWhileIdle()

    3. setAlarmClock()


    Make changes for AndroidManifest.xml :

    <uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM"
        android:maxSdkVersion="32" />
    <uses-permission android:name="android.permission.USE_EXACT_ALARM" />
    

    Note :

    • Identify exact alarm usage: Exclude any code you are unwilling to give up, and then identify the sections that utilize setExact(), setExactAndAllowWhileIdle(), or setAlarmClock() methods in the AlarmManager class.

    • Replace with inexact alarms: Instead of the above-mentioned techniques, setWindow() method in alarm class or setTriggerAtMillis() is more preferable. It enables one to set alarms with a particular delay (margin of time) instead of a definite time. The power of the tolerance is adjustable in accordance with the necessities of the application.

    • If the exact alarm is set using an OnAlarmListener object, like in the setExact API, the SCHEDULE_EXACT_ALARM permission isn't required.


    Update 1

    Regarding publishing on Google Play.

    Can you check the bundle which you uploaded must be still active now in any of the testing track like closed open alpha or you have not done 100% rollout of production latest version. Updating the track with latest version will fix this warning as that bundle still has the permission. You can replace them with the updated build then this error will be fixed.