Open aaroncraigongithub opened 11 years ago
+1 Experiencing same behavior as @mmacmillan
+1 Experiencing same behavior as @mmacmillan an @JWesorick
@aBuder @JWesorick I am wondering if you are talking about that onResume issue, that it does not pull in the push notification into the App,(No ECB when onResume when app icon is clicked). As i am facing that problem, i read that on version 2.4.0 thats not an issue anymore. But i dont seem to read anywhere on documentation about how to handle onResume(either by clicking the App icon, or from Android).
+1 Experiencing same behavior as @mmacmillan an @JWesorick and @aBuder
+1 Experiencing same behavior
Try making your ecb callbacks global for ios and android. i.e window.onNotificationAPN = function(){ ... } window.onNotification = function(){ ... }
Try making your ecb callbacks global for ios and android. i.e window.onNotificationAPN = function(){ ... } window.onNotification = function(){ ... }
Yeah, that should solve it!
Farshid
window.onNotificationAPN = function(){ ... }
mrameezraja, You are genius! Thanks, this works on iOS for me.
Making it a global function doesn't fix the issue for me. any other solution?
Can you share your code ?
I have found the solution for this one. The reason for this issue is that in PushPlugin.m
the callback
property is set to nil
on killing the app. As a result, the check on line#202 is not satisfied in the - (void)notificationReceived
callback. The fix for the issue is to instantiate the PushPlugin
class on opening the push notification every time your app starts. This can be done by registering the push notification plugin on app start.
Call the pushNotification.register
method in your javascript everytime your app starts, and this will instantiate the plugin and assign the appropriate callback
the plugin. I have added the below code to my Ionic
app's app.run()
section
window.plugins.pushNotification.register(successCallback, errorCallback, {
badge: 'true',
sound: 'true',
alert: 'true',
ecb: 'window.onNotificationAPN'
})
Let me know if anyone still faces this issue.
@mrameezraja ur solution fixed the problem thx !
I've done a full write up of the problem on the PG Build forum, as I assumed to begin with that this was an issue with Build.
They have directed me to post an issue here, though, so here you go :)
http://community.phonegap.com/nitobi/topics/ios_ecb_callback_not_firing_with_pushnotification_plugin
The summary of the post is: Using more or less the boilerplate example, everything works as expected on Android. iOS calls the token handler, but does not call the ecb callback. If the app is in the background the notice is displayed in the notification area or the lock screen on iOS, but activating the app still doesn't cause the ecb handler to run.