Added check to exact scheduling for notifications #659
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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).
And because the SCHEDULE_EXACT_ALARM permission is now denied by default and the permission grant process requires extra steps from users (the user must minimize the application and change the setting), developers are strongly encouraged to evaluate their use cases and determine if exact alarms still make sense for their use cases.
Now for Android devices with SDK greater than or equal to 33, a check has been added for the ability to schedule notifications via AlarmManager.setExactAndAllowWhileIdle(). If this is not possible, then the notification is sent via AlarmManager.set().
For AlarmManager.set() only needs android.permission.POST_NOTIFICATIONS. It can be easily obtained through a modal window using native.showPopup( "requestAppPermission", options )
More information:
https://developer.android.com/about/versions/14/changes/schedule-exact-alarms