Open JaimeAr opened 6 years ago
I'm trying to integrate notifications with OneSignal but I do not know what SDK to use, if Ionic or Cordova.
For both cases I install the plugin "cordova plugin add onesignal-cordova-plugin --save"
"cordova plugin add onesignal-cordova-plugin --save"
But I can not find where to put this part of the code to initialize OneSignal
Add the following to your existing ready fuction.
.run (function ($ ionicPlatform) { $ ionicPlatform.ready (function () { // Enable to debug issues. // window.plugins.OneSignal.setLogLevel ({logLevel: 4, visualLevel: 4}); var notificationOpenedCallback = function (jsonData) { console.log ('notificationOpenedCallback:' + JSON.stringify (jsonData)); }; window.plugins.OneSignal .startInit ("YOUR_APPID") .handleNotificationOpened (notificationOpenedCallback) .endInit (); })
.run (function ($ ionicPlatform) {
$ ionicPlatform.ready (function () {
// Enable to debug issues.
// window.plugins.OneSignal.setLogLevel ({logLevel: 4, visualLevel: 4});
var notificationOpenedCallback = function (jsonData) {
console.log ('notificationOpenedCallback:' + JSON.stringify (jsonData));
};
window.plugins.OneSignal
.startInit ("YOUR_APPID")
.handleNotificationOpened (notificationOpenedCallback)
.endInit ();
})
Does anyone have any ideas? Ref: https://documentation.onesignal.com/docs/ionic-sdk-setup
I'm trying to integrate notifications with OneSignal but I do not know what SDK to use, if Ionic or Cordova.
For both cases I install the plugin
"cordova plugin add onesignal-cordova-plugin --save"
But I can not find where to put this part of the code to initialize OneSignal
Add the following to your existing ready fuction.
.run (function ($ ionicPlatform) {
$ ionicPlatform.ready (function () {
// Enable to debug issues.
// window.plugins.OneSignal.setLogLevel ({logLevel: 4, visualLevel: 4});
var notificationOpenedCallback = function (jsonData) {
console.log ('notificationOpenedCallback:' + JSON.stringify (jsonData));
};
window.plugins.OneSignal
.startInit ("YOUR_APPID")
.handleNotificationOpened (notificationOpenedCallback)
.endInit ();
})
Does anyone have any ideas? Ref: https://documentation.onesignal.com/docs/ionic-sdk-setup