Comments (21)
We are experiencing the same issue with version 1.1.1
, but it seems to work ok with version 1.0.1
.
from phonegap-plugin-push.
@do34 and @martinfilliau what is the reproduction scenario for this one?
I have an app that is registered with my push service. I make sure it is not running by doing a swipe up on it in the task list in iOS. Then I send an push to the app and it shows up in the notification shade. When I click on this notification the app is started and my onNotification handler is executed with the info of the push notification.
What am I missing?
from phonegap-plugin-push.
@macdonst your scenario is correct, and it does work for us in version 1.0.1
but couldn't get it to work in 1.1.1
. seems to be also described in #55 albeit I'm not sure which version is used.
from phonegap-plugin-push.
Same problem here
from phonegap-plugin-push.
I am having the same problem. The notification event is not fired in the iOS if the app was closed when the push notification was received.
from phonegap-plugin-push.
I can reproduce this in version 1.2.2 - it works fine in Android but not iOS. I created a blank app and copied the code from the example/www folder into the app.
In the example app, the "card" with the notification details is only displayed if the app is open when the notification is received. If the app is not running and launched from the notification, the card with the notification details does not get displayed.
from phonegap-plugin-push.
I think this might be a misunderstanding. It does work, but only if you tap the notification. If you just start the app it doesn't. Is this expected behaviour?
from phonegap-plugin-push.
No, the problem apears when you tap de notification (when you tap the app icon it will never show the notification data)
from phonegap-plugin-push.
I can now consistently reproduce the problem:
- Close the app and lock the device.
- Trigger a push notification.
- Either swipe the notification on the lock screen or unlock the device and pull down notification centre, then tap the notification.
- The
didReceiveRemoteNotification
method does not get called.
After this process, when the app is already running, the functionality works as expected. Until you close the app (double tap home, swipe up) and lock the device again.
Even if you kill the app, it still responds to notifications when you tap them, as long as you haven't locked the device in between.
Reading this, it could be expected functionality?!? http://stackoverflow.com/questions/19068762/will-ios-launch-my-app-into-the-background-if-it-was-force-quit-by-the-user
from phonegap-plugin-push.
Anything new about this issue?
from phonegap-plugin-push.
@greg84 it seems that this is expected behaviour by iOS. The notification event doesn't get called until you tap on the notification.
I think you are looking for the same functionality as #93?
from phonegap-plugin-push.
Just to clarify, #93 is talking about the app being able to run code while the app is closed when a notification is received. In this case however, I'm talking about the app running code when it is launched from a notification after being killed by the user (i.e. the user taps the notification to launch an app that's previously been forcibly closed from the app switcher).
I'm talking specifically about the following repro steps using the example app (where cards appear when a notification is received).
- Open the app, trigger a notification, new card appears.
- Go back to home screen, lock the device, trigger a notification, tap notification, app opens and new card appears.
- Kill the app from the app switcher, lock the device, trigger a notification, tap notification, app opens but no new card appears.
I would expect number 3 to display a new card. It seems that this is expected behavior after the app has been forcibly closed by the user, but it's a bit strange. I'm not sure why killing the app should prevent the didReceiveRemoteNotification
method from being called when the app resumes.
I could understand that if a user kills an app that runs code when a notification is received (like #93 talks about), you probably wouldn't want that to happen if you'd manually killed the app and stopped it from running. But I would still expect the method to run when I launch the app again from the notification.
As the links below explain, when a user force-closes the app, the callback method is no longer invoked.
I've been reading the iOS docs. This section talks about the didReceiveRemoteNotification
delagate:
If the app is not running when a remote notification arrives, the method launches the app and provides the appropriate information in the launch options dictionary. The app does not call this method to handle that remote notification. Instead, your implementation of the application:willFinishLaunchingWithOptions: or application:didFinishLaunchingWithOptions: method needs to get the remote notification payload data and respond appropriately.
My testing suggests that this hasn't been implemented properly. Although I might be misunderstanding how it actually works, in which case accept my apologies.
from phonegap-plugin-push.
@greg84 just making sure. The worst part about this issue is that I'm following your reproduction scenario and in step three I do get the notification event in my sample app which creates a new card.
What version of iOS are you using?
from phonegap-plugin-push.
@greg84 Please take a look at the attached video and let me know what I'm doing wrong trying to reproduce your problem.
https://dl.dropboxusercontent.com/u/887989/pushplugin/Issue50.mov
from phonegap-plugin-push.
@macdonst The steps you followed in the video are the same as what I'm doing. Only difference is I'm using ios 8.4.1 on an iPad. I wonder if Apple fixed it in the latest update?
from phonegap-plugin-push.
@greg84 you, I can reproduce on 8.4.1 now to see if there is anything I can do about it.
from phonegap-plugin-push.
What you guys use as a solution on a case where the user launched the app using the icon on menu?
I think this is most common on IOS.
from phonegap-plugin-push.
I gotta give up on this one as I believe it to be a bug with iOS 8.4.1. If anyone has a fix I'd love to merge a PR.
from phonegap-plugin-push.
I have found the solution for this one. The reason for this issue is that in PushPlugin.m
the callbackId
property is set to nil
on killing the app. As a result, the check on line#441 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 PushPlugin.init
method in your javascript everytime your app starts, and this will instantiate the plugin and assign the appropriate callback
and callbackid
in the plugin. I have added the below code to my Ionic
app's app.run()
section
window.PushNotification.init({
ios: {
"badge": false,
"sound": true,
"alert": true,
"clearBadge": true
}
})
Let me know if anyone still faces this issue.
from phonegap-plugin-push.
Hi @Addi90 , i follow your solution but I always have this problem.
the callbackId property is nil when my app is in foreground and background but when my app closed my property is nil .
from phonegap-plugin-push.
This thread has been automatically locked.
from phonegap-plugin-push.
Related Issues (20)
- Callbacks (hasPermission, register) are not called on iOs 13 HOT 3
- @parmarkaushik15 yeah, like I said in my last comment, if the app is forced closed there is no web view in memory to run the JS. The best you can do at this point is look into using the force start parameter. HOT 1
- ios: notification event not firing after app is closed when user opens app directly - works on android HOT 1
- On notification event not firing when cordova local notification plugin is installed. HOT 5
- IOS. Does not show 'Allow / Deny' notification dialog and not receiving push notification
- Blank screen is displayed in few devices instead of picture
- iOS13 APNS Device Token HOT 2
- getNotificationSettingsWithCompletionHandler - completion handler never executes on iOS 9.3.5
- Incompatibilty phonegap-plugin-push whit cordova-plugin-googlemaps HOT 5
- Unable to send push to browser(Firefox, Chrome) using fcm/gcm getting 'InvalidRegistration'
- On Android it receives notifications but they don't appear on Firebase Analytics
- Not every key in the firebase's {android/ios}.notification object is supported in "additionalData" object
- Unable to compile 2.3.0
- HELP - Failed to install 'phonegap-plugin-push': undefined - cocoapods -macOs Catalina HOT 1
- registration is not called
- iOS: Can't process background notification on low battery
- Security Error with android:exported=true
- [Android] on('notification') 'coldstart' value is acting wacky and not as documented (works only on iOS)
- Sporadic registrations on iOS using Xcode
- FCM version is not up-to-date.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from phonegap-plugin-push.