Bruce Stuart
Posts: 0
Joined: Fri Oct 24, 2014 4:42 am

how to use onesignal plugin push notificacions

In terms of things we would try normally in this type of situation... It would be to check every other plug-in that is in your app and turn it off including as many of the ones that come “standard“ in an appery Build ... thus possibly identifying where one plug-in might conflict with another...

You might also try... After you have done what’s above... And if you had not had any success... You might try doing a back up completely... And then reverting your Appery.io libraries version back one.

If either of the above approaches is Successful... Then try adding things back one at a time and building one at a time...

Of course along the way you may need to comment out some of your application code or potentially try to start with a shell application and put in only the one signal plug in...

Just some ideas we would try If faced with the same challenge

Best,

Bruce

Image

Z. Rohan
Posts: 0
Joined: Mon Jun 19, 2017 2:13 am

how to use onesignal plugin push notificacions

Great new for everyone following this thread. Last week I got the OneSignal Cordova plugin working in my app on both iOS and Android!

I think Tiago might have been lucky to have downloaded the plugin before OneSignal changed it. The current plugin on GitHub is not compatible with Appery.

But their older one, named onesignal-cordova-plugin-pgp-compat works perfectly!

I messaged OneSignal and they said it is safe to use that older plugin. It won’t give all the new features, but for me I only wanted to receive push notifications and register the device (adding user tags for Segments), and those both work perfectly.

The problem is that it is harder to find this old plugin. It’s an older branch on GitHub, so you’ll have to dig around for it.

Rohan

SteveLacy
Posts: 6
Joined: Fri Apr 20, 2012 11:54 pm

how to use onesignal plugin push notificacions

Awesome news Rohan!

Although I found the following:

https://github.com/OneSignal/OneSigna...

This didn't work for me. Ugh. Can you attach the plugin or send me a link?

I also invoked the normal PushPlugin as well. If you can provide the plugin and any details to make it work, I will be so appreciative! You said it was called "onesignal-cordova-plugin-pgp-compat" but I only found the one that said ".. pgb-compat".

Thanks,

Steve

Rohan
Posts: 0
Joined: Wed Jul 26, 2017 11:54 pm

how to use onesignal plugin push notificacions

That looks like the one I used. I typed the name wrong, it's: OneSignal-Cordova-SDK-PGB-Compat so it looks like the one you found.

I just imported it and activated it in my app settings and then followed the OneSignal instructions to initialize.

What happens when you try it?

SteveLacy
Posts: 6
Joined: Fri Apr 20, 2012 11:54 pm

how to use onesignal plugin push notificacions

So I have created a test app that only has a home screen that calls the OneSignal javascript init. I put an alert before the init call and one after stating it has finished.

When I launch the app, I get the alert of the "init started" and then just the spinner icon that never finishes (the "finished" alert never appears).

I had imported the OneSignal Push Notifications PGB Compat. When I enable it, the plugin shows it's version 2.0.10. Is that the version you're using?

I have my app to use the latest Appery resources library version 4.1.

I don't have any other Core Cordova plugins enabled other than the PushPlugin version 1.8.4.

If you have any suggestions, or if you're able to provide your specific versions and settings that worked for you, that would be awesome!

Thanks!

Steve

Rohan
Posts: 0
Joined: Wed Jul 26, 2017 11:54 pm

how to use onesignal plugin push notificacions

Hi Steve,

I'm using 2.0.10 of the plugin, so I'm not sure why it's not working for you.

Are you testing it on a real device?

Are you doing an ionic app or jquery? My app is using ionic.

My init code is:

code
// logging
window.plugins.OneSignal.setLogLevel({
logLevel: 3,
visualLevel: 0
});
window.plugins.OneSignal.startInit(osk).inFocusDisplaying(window.plugins.OneSignal.OSInFocusDisplayOption.None).handleNotificationOpened(notificationOpenedCallback).handleNotificationReceived(notificationReceivedCallBack).endInit();
/code

SteveLacy
Posts: 6
Joined: Fri Apr 20, 2012 11:54 pm

how to use onesignal plugin push notificacions

I'm using the jquery app.

My init code is:

alert('starting OneSignal...');
window.plugins.OneSignal
.startInit("2df02c34-409f-4d54-ba6d-34b9a6a2ea6d")
.handleNotificationOpened(notificationOpenedCallback)
.endInit();
alert('OneSignal done');

Perhaps the issue is with the jquery app?

Rohan
Posts: 0
Joined: Wed Jul 26, 2017 11:54 pm

how to use onesignal plugin push notificacions

It could be, since I've never tried it in jquery app. As a test, you can create a blank ionic project and see if it works there.

Also, are you defining the notificationOpenedCallback variables with a function, example something like:

code
// logging
LOG && window.plugins.OneSignal.setLogLevel({
logLevel: 3,
visualLevel: 0
});

Code: Select all

         // handler for tapping on a notification outside of app 
         var notificationOpenedCallback = function(jsonData) { 
                 $scope.notif_pushProcess({ 
                     notification: jsonData.notification, 
                     inApp: false 
                 }); 
             }; 

         // handler for a notification received while inside the app 
         var notificationReceivedCallBack = function(jsonData) { 
                 $scope.notif_pushProcess({ 
                     notification: jsonData, 
                     inApp: true 
                 }); 
             }; 

         window.plugins.OneSignal.startInit(osk).inFocusDisplaying(window.plugins.OneSignal.OSInFocusDisplayOption.None).handleNotificationOpened(notificationOpenedCallback).handleNotificationReceived(notificationReceivedCallBack).endInit(); 

/code

Tiago Martins
Posts: 0
Joined: Fri Sep 05, 2014 12:41 am

how to use onesignal plugin push notificacions

Hi Steve,

Did you start the onesignal plugin in the "device ready" event?

window.plugins.OneSignal
.startInit("xxxxxxxx-xxxx-xxx-xxxx-xxxxxxxxxxxx")
.endInit();

Also add "SENDER_ID" parameter in the pushplugin (cordova plugins).

BR
Tiago

Tiago Martins
Posts: 0
Joined: Fri Sep 05, 2014 12:41 am

how to use onesignal plugin push notificacions

Hi,
Did you start the onesignal plugin in the "device ready" event?

window.plugins.OneSignal
.startInit("xxxxxxxx-xxxx-xxx-xxxx-xxxxxxxxxxxx")
.endInit();

BR
Tiago

Return to “Issues”