OneSignal-Cordova-SDK icon indicating copy to clipboard operation
OneSignal-Cordova-SDK copied to clipboard

addPermissionObserver function doesn't return any information

Open geshub opened this issue 3 years ago • 4 comments

Description:

Running the example from the documentation:

window.plugins.OneSignal.addPermissionObserver(function(stateChanges) {
  console.log("Push permission state changed: " + JSON.stringify(stateChanges, null, 2));
});

The callback function is fired correctly at each permission changes in my app but the returned variable stateChanges is always empty. addSubscriptionObserver is also fired correctly on my app and returns the correct stateChanges

Environment onesignal-cordova-plugin v 3.0.0 with Angularjs / Android 10 and 11

Steps to Reproduce Issue:

  1. Add the onesignal-cordova-plugin to your project
  2. Initialize the plugin with your app ID
  3. change the system settings to allow or disable notifications for the application
  4. window.plugins.OneSignal.addPermissionObserver callback is called but stateChanges is always empty

Anything else:

function always returns:

Push permission state changed: { "from": {}, "to": {} }

geshub avatar Sep 26 '21 17:09 geshub

+1

sajath-45 avatar Oct 02 '21 00:10 sajath-45

Any news on that one ?

geshub avatar Oct 31 '21 11:10 geshub

+1

addPermissionObserver works fine on iOS.

On Android addPermissionObserver always returns: Screen Shot 2021-11-12 at 11 30 09 AM

Cordova Packages:

    cli: 10.0.0
        common: 4.0.2
        create: 3.0.0
        lib: 10.1.0
            common: 4.0.2
            fetch: 3.0.1
            serve: 4.0.0

Project Installed Platforms:

    android: 10.0.1
    ios: 6.2.0

Project Installed Plugins:

    cordova-plugin-device: 2.0.3
    cordova-plugin-hidescrollbar: 1.0.2
    cordova-plugin-network-information: 3.0.0
    cordova-plugin-splashscreen: 6.0.0
    cordova-plugin-statusbar: 2.4.3
    cordova-plugin-webview-proxy: 0.0.3
    cordova-sqlite-storage: 6.0.0
    onesignal-cordova-plugin: 3.0.0

mebeingken avatar Nov 12 '21 19:11 mebeingken

addPermissionObserver works fine on iOS.

Thanks for the information, didn´t check it on IOS

geshub avatar Nov 13 '21 12:11 geshub