cordova-plugin-android-permissions icon indicating copy to clipboard operation
cordova-plugin-android-permissions copied to clipboard

Trouble with requesting SCHEDULE_EXACT_ALARM permission for Android 14

Open jondspa opened this issue 1 year ago • 1 comments

Hi -

For Android 14, I need to request user runtime permission for SCHEDULE_EXACT_ALARM in order to send notifications from my app. Putting the permission in the manifest file is not enough.

I expect the below code to ask the user for permission but instead it just returns false. When I run the below code, I always get "success false."

Is this a problem in the plugin or am I doing wrong?

Thanks! - Jon

 permissions.hasPermission(permissions.SCHEDULE_EXACT_ALARM, function (status) {
    if (!status.hasPermission) {
        permissions.requestPermission(permissions.SCHEDULE_EXACT_ALARM, function success(status) {
            console.log("success " + status.hasPermission);
        }, function error() {
            console.log("error");
        });
    }
});

jondspa avatar Apr 11 '24 00:04 jondspa