Giter Club home page Giter Club logo

Comments (21)

martinfilliau avatar martinfilliau commented on July 20, 2024

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.

macdonst avatar macdonst commented on July 20, 2024

@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.

martinfilliau avatar martinfilliau commented on July 20, 2024

@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.

 avatar commented on July 20, 2024

Same problem here

from phonegap-plugin-push.

arlago avatar arlago commented on July 20, 2024

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.

greg84 avatar greg84 commented on July 20, 2024

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.

greg84 avatar greg84 commented on July 20, 2024

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.

 avatar commented on July 20, 2024

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.

greg84 avatar greg84 commented on July 20, 2024

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.

 avatar commented on July 20, 2024

Anything new about this issue?

from phonegap-plugin-push.

macdonst avatar macdonst commented on July 20, 2024

@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.

greg84 avatar greg84 commented on July 20, 2024

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).

  1. Open the app, trigger a notification, new card appears.
  2. Go back to home screen, lock the device, trigger a notification, tap notification, app opens and new card appears.
  3. 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.

http://stackoverflow.com/questions/18856204/applicationdidreceiveremotenotificationfetchcompletionhandler-not-called

http://stackoverflow.com/questions/19068762/will-ios-launch-my-app-into-the-background-if-it-was-force-quit-by-the-user/19202487#19202487

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.

macdonst avatar macdonst commented on July 20, 2024

@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.

macdonst avatar macdonst commented on July 20, 2024

@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.

greg84 avatar greg84 commented on July 20, 2024

@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.

macdonst avatar macdonst commented on July 20, 2024

@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.

italoayres avatar italoayres commented on July 20, 2024

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.

macdonst avatar macdonst commented on July 20, 2024

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.

addityasingh avatar addityasingh commented on July 20, 2024

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.

ngt14 avatar ngt14 commented on July 20, 2024

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.

lock avatar lock commented on July 20, 2024

This thread has been automatically locked.

from phonegap-plugin-push.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.