androidalarmmanagerlint

SCHEDULE_EXACT_ALARM in manifest causes lint error


When adding the following permission to the AndroidManifest it results in a lint error:

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

Lint error

According to policy I cannot use the USE_EXACT_ALARM permission instead: we're not an alarm, timer or calendar app. it's a minor functionality.

So I suppose SCHEDULE_EXACT_ALARM is the one we need. However, we're a mobile app, not a system app. What to do to fix this error, while using an exact alarm as minor feature for our app?


ps. It looks to me as if Android says: only use exact alarms in very specific usecases, otherwise you're not allowed to do so on an app (since Android 13). If so, why not being upfront with that in their documentation?

However, we DO need the alarm to be more exact than 10 minutes (see setWindow) and it cannot be suspended in the background either (see set).


Solution

  • Apparently it's an issue with lint, and fixed in the latest gradle plugin (8.7.3): https://issuetracker.google.com/issues/375352607