taivo / parse-push-plugin

Push notification plugin for Cordova/Phonegap/ionic on Parse platform
118 stars 102 forks source link

iOS - No receivePN when app in foreground #74

Closed rooswelt closed 7 years ago

rooswelt commented 7 years ago

receivePN is never trigger when app is in foreground on iOS. Notification is not show either

Is this the expected behaviour?

quilligana commented 7 years ago

ParsePushPlugin.on('receivePN', function (pnObj) { should trigger when you receive a notification in the foreground on iOS. A notification will not show however. You can show an alert, toast or something similar within the app.

I put my plugin callbacks inside a document ready callback for safety also.

taivo commented 7 years ago

Hello @rooswelt , has @quilligana 's comment address your issue?

If not, please give us a bit more context regarding how you've setup the receivePN handlers.

rooswelt commented 7 years ago

This is the code I have in my app:

$ionicPlatform.ready(function() { if (window.ParsePushPlugin) { ParsePushPlugin.on('receivePN', function(pn) { alert('yo i got this push notification:' + JSON.stringify(pn)); }); ParsePushPlugin.on('openPN', function(pn) { alert('a notification was opened:' + JSON.stringify(pn)); }); } });

openPN is triggered normally when opening app from a notification receivePN is not triggered even if notification is sent (I see that in parse dashboard).

Note: I use parse dashboard to send text-only notifications.

rooswelt commented 7 years ago

RESOLVED

I had phonegap-plugin-push installed also from previous tests. I removed it, everything works as expected.

Thanks @quilligana and @taivo for the support anyway

Hope it helps