OneSignal / OneSignal-Cordova-SDK

OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your Ionic, PhoneGap CLI, PhoneGap Build, Cordova, or Sencha Touch app with OneSignal. Supports Android, iOS, and Amazon's Fire OS platforms. https://onesignal.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug]:

phiasco12 opened this issue · comments

What happened?

The latest update does not Ask for push notification permission Nor does it register the device in OneSignal platform! I can Also I only install the plugin from onesignal-cordova-plugin but not from GitHub anymore! the code that I am using used to work with the older version of the plugin but I have been forced to upgrade to the latest version and now nothing works.

Steps to reproduce?

installed the plugin from:

onesignal-cordova-plugin

used this code:

function OneSignalInit() {

        // Initialize OneSignal with your app ID
        window.plugins.OneSignal.setAppId(oneSignalId);
        
        // Set notification opened handler
        window.plugins.OneSignal.setNotificationOpenedHandler(function(jsonData) {
            alert('notificationOpenedCallback: ' + JSON.stringify(jsonData));
        });

        // Set external user ID
        window.plugins.OneSignal.setExternalUserId(externalUserId);

        // Prompt for push notifications
        window.plugins.OneSignal.promptForPushNotificationsWithUserResponse(function(accepted) {
            alert("User accepted notifications: " + accepted);
            if (accepted) {
                alert("User accepted push notifications.");
            } else {
                alert("User did not accept push notifications.");
            }
        });
   
}

OneSignalInit();

What did you expect to happen?

1- ask for Push notifications permission on iOS device
2- register the device in OneSignal dashboard

OneSignal Cordova SDK version

5.1.4

Which platform(s) are affected?

  • iOS
  • Android

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Hello @phiasco12 thanks for reaching out! SDK versions 5.0.0 and greater are a new major release with breaking changes. We have new methods for those provided in your code. Please see our migration guide for full details on upgrading.

Let us know if you have any additional questions or concerns!