cordova-plugin-android-permissions
cordova-plugin-android-permissions copied to clipboard
POST_NOTIFICATION not working
When i request the new POST_NOTIFICATION permission on android platform, nothing be shown
Can someone help me ?
this is my code:
this.androidPermissions.checkPermission(this.androidPermissions.PERMISSION.POST_NOTIFICATIONS).then( result => { console.log('Has permission?', result.hasPermission) if (!result.hasPermission) this.androidPermissions.requestPermission(this.androidPermissions.PERMISSION.POST_NOTIFICATIONS); });
I had the same problem. OS: Android 13 Compile with SDK 32 or 33
When I made the "requestPermission" for POST_NOTIFICATIONS, I receive an error :
{
error: "requestPermission"
message: "Unknown error."
}
I try to request READ_CONTACTS and I receive success with { hasPermission: false } and nothing shown
same. not working nothing show....
Hi, I have the same problem has anyone found a solution for this issue?
I have the same problem. The Allow permission modal is NOT shown for POST_NOTIFICATIONS
If I change permission to CAMERA then it works - the Allow permission modal IS shown. BUT not the first time. The app must be restarted for it to start working. Weird
Android Target SDK: android-33
Android Compile SDK: 33
is there an alternate plugin?
Add the required permission here:

Hithere, Did you add
<preference name="android-targetSdkVersion" value="33" />
in the config.xml?
Greetings, Simeon
i have the same problem:

I have same problem
<preference name="android-targetSdkVersion" value="33" />
permissions
.hasPermission(
permissions.POST_NOTIFICATION,
(status: any) => {
if (!status.hasPermission) {
permissions
.requestPermission(
permissions.POST_NOTIFICATION,
(data: any) => {
console.log('PERMISIONS', data);
result.resolve(true);
},
() => {
result.reject(false);
}
)
}
}
);
Hithere, Did you add
<preference name="android-targetSdkVersion" value="33" />in the config.xml?
Greetings, Simeon
save me! Thanks
Hithere, Did you add
<preference name="android-targetSdkVersion" value="33" />in the config.xml?
Greetings, Simeon
where is those config.xml file location ?
Hithere, Did you add
<preference name="android-targetSdkVersion" value="33" />in the config.xml? Greetings, Simeonwhere is those config.xml file location ?
For projects created with the Cordova CLI (described in The Command-Line Interface), this file can be found in the top-level directory:
app/config.xml
Hope this helps.
Greetings
Hi,
permissions.POST_NOTIFICATION is still not working.
I am using cordova android 11
Use this plugin cordova.plugins.diagnostic.
Hi @wtto00
thx for advice and I tested it. I found usefull these two methods isRemoteNotificationsEnabled and switchToNotificationSettings
let diagnostic = (cordova.plugins as any)?.diagnostic;
diagnostic.isRemoteNotificationsEnabled((enabled) => {
console.log("Remote notifications are " + (enabled ? "enabled" : "disabled"));
}, (error) => {
console.error("The following error occurred: " + error);
});
diagnostic.switchToNotificationSettings();
This is what worked for me with the plugin .
var permissions = cordova.plugins.permissions;
permissions
.hasPermission(
permissions.POST_NOTIFICATIONS,
(status) => {
if (!status.hasPermission) {
permissions
.requestPermission(
permissions.POST_NOTIFICATIONS,
(data) => {
alert('PERMISIONS: ' + JSON.stringify(data));
},
(err) => {
alert('PERMISIONS: ' + JSON.stringify(err));
}
)
}
}
);
add this to the manifest:
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />