Hello guys.
I have a problem with the native plugin OneSignal.
I want to check if the user have enabled or disabled the push notification permission.
In the doc, we learn that this function “addPermissionObserver” doing this but i don’t have any information.
This is my code :
test() {
this.oneSignal.addPermissionObserver().subscribe((state)=>{
console.log(state.hasPrompted);
console.log(state.status);
});
}
I call my test function with a button for the dev only.
I found other solution with the function “getPermissionSubscriptionState” but in the promise, i get nothing
test() {
this.oneSignal.getPermissionSubscriptionState()
.then(e=>{
console.log(e.permissionStatus.status);
})
}
}
Thanks for the help.
Best regards ;p