Little question
me42th opened this issue · comments
❓ ❓ ❓
Is it correct?
.addPermissionObserver(function(state) {
console.log("Notification permission state changed: " + state.hasPrompted);
console.log("Notification permission status: " + state.status);
});
❗ ❗ ❗
I'm only have success with this
this.signal.addPermissionObserver().subscribe(
value => {
I'm not like unfollow the oficial docs, tnks anyway
I'm using Ionic v4 with capacitor
addPermissionObserver
takes a function as you have listed first. The state
has a from
and to
object under it however.
window.plugins.OneSignal.addPermissionObserver(function(state) {
console.log("Notification permission state changed: " + state.to.hasPrompted);
console.log("Notification permission status: " + state.to.status);
});
We have updated the docs to correct this.
See the definition of addPermissionObserver
from the onesignal-cordova-plugin
below.
https://github.com/OneSignal/OneSignal-Cordova-SDK/blob/bcf90e51ec765e2e71a7393270714d63ca4db9ca/www/OneSignal.js#L116-L124
Is this.signal
in your example just assigned from window.plugins.OneSignal
? Or did you use a different library other than onesignal-cordova-plugin
from npm?
tnkz brow