Skip to content
This repository has been archived by the owner on Sep 4, 2020. It is now read-only.

iOS 10 is not firing the 'notification' event after clicking on a notification when the app is in hibernate #1199

Closed
nick-adriaenssens opened this issue Sep 6, 2016 · 23 comments
Assignees

Comments

@nick-adriaenssens
Copy link

After clicking on a notification a hibernated app should open and the 'notification' event should fire, this is not the case for iOS 10 devices. The app opens but the event is not fired.

Tested on iPad Pro and iPhone 5S.

iOS version: iOS 10 public beta 6 & 7
Cordova version: 6.2.0
Cordova iOS version: 4.2.0
Plugin version: 1.8.1

@Wouter33
Copy link

Wouter33 commented Sep 9, 2016

Same here! If the app is killed and opened from the notification it works fine. But if it has been put to the background recently it doesn't trigger the notification event.

iOS Device: iPhone 6
iOS version: iOS 10 gold master
Cordova version: 6.3.0
Cordova iOS version: 4.2.0
Plugin version: 1.8.1

@krik
Copy link

krik commented Sep 9, 2016

I can also reproduce this with IOS 10.0.1 GM, cordova-ios 4.2.1, phonegap-plugin-push 1.8.1

@denyo
Copy link

denyo commented Sep 9, 2016

Same here.

@macdonst
Copy link
Member

macdonst commented Sep 9, 2016

Hey all, I'm traveling for work all next week, 4 cities in 8 days, so if anyone can help out with this issue that would be great.

@worm-emoji
Copy link

+1

@dortzur
Copy link

dortzur commented Sep 12, 2016

+1 consistently reproduces.

@macdonst
Copy link
Member

Updating my dev environment in order to look at this. Hope for some news soon but any help is still appreciated.

@macdonst
Copy link
Member

Yup, I can reproduce it. After much struggling with iOS signing certs.

macdonst added a commit that referenced this issue Sep 14, 2016
…king on a notification when the app is in hibernate
@macdonst
Copy link
Member

@NickAdriaenssens Okay, I did a quick fix for this issue which I pushed up to the issue1199 branch. I'd appreciate some help in testing it.

@denyo
Copy link

denyo commented Sep 14, 2016

Looks good on my end. Back to how it was before iOS 10.
Thank you!

@nick-adriaenssens
Copy link
Author

@macdonst Thank you for looking into this!
I can confirm the fix works on multiple iOS 10 devices.

@malwatte
Copy link
Contributor

came across this issue as well. Good to hear that it is fixed.
But how can I install the plugin with the above changes?
Thanks,

@denyo
Copy link

denyo commented Sep 14, 2016

cordova plugin add https://github.com/phonegap/phonegap-plugin-push.git#issue1199 --variable SENDER_ID="XXX"

@macdonst
Copy link
Member

@NickAdriaenssens @denyo any chance of you testing on iOS 9 devices as well? With me being on the road I only had one device which I had to upgrade for iOS 10 to reproduce the issue.

@macdonst macdonst removed the retest label Sep 14, 2016
@macdonst macdonst self-assigned this Sep 14, 2016
@nick-adriaenssens
Copy link
Author

@macdonst It is working on iPhone 6 and iPad Mini with iOS 9.3.2

@macdonst
Copy link
Member

Great, I merged it into master and I will release a 1.8.2 sometime today.

@WilsonFpz
Copy link

Hi thanks a lot.
Could we install v1.8.2 via cordova plugin add ?
it is v1.8.1 currently. thanks again.

@macdonst
Copy link
Member

@WilsonFpz yeah, you should just be able to do cordova plugin add phonegap-plugin-push as it is the latest version on npm.

@C-Nedelcu
Copy link

C-Nedelcu commented Oct 2, 2016

Hello,

I installed Phonegap today (npm install phonegap@latest), created a sample project with the tutorial on their site http://docs.phonegap.com/tutorials/develop/push-notifications/

But I am still having the issue described in this thread. Here are the steps to reproduce.

These are the plugin versions I am using:

$NotifTest>phonegap plugin
cordova-plugin-console 1.0.4 "Console"
cordova-plugin-dialogs 1.2.1 "Notification"
cordova-plugin-statusbar 2.1.3 "StatusBar"
cordova-plugin-whitelist 1.2.2 "Whitelist"
phonegap-plugin-push **1.8.2** "PushPlugin"

I then run the freshly download iOS PhoneGap app on my iOS 10.0.2 iPhone 6S. All looks good. Then, from the windows command line, I run the following commands to send notifications:

phonegap push --deviceID ** --service apns --payload "{ \"aps\": { \"alert\": \"click here please\", \"content-available\": 1, \"title\":\"test-title\", \"message\": \"test-message\", \"sound\": \"default\" }, \"data\": {\"content-available\":1, \"notId\": 12312412899}, \"moredata\": \"TEST PUSH\", \"content-available\": 1 }"

phonegap push --deviceID ** --service apns --payload "{\"aps\": {\"data\": \"Test silent background push\",\"moredata\": \"Do more stuff\",\"content-available\": 1}}"

phonegap push --deviceID ** --service apns --payload "{\"aps\":{\"alert\":{\"title\":\"Welcome\", \"body\":\"In this world\"},\"badge\":1,\"sound\":\"default\"}}"

When the app is in the foreground, I get these notifications - everything is fine.
But when the app is in the background, I get the alert message on my phone / in the notification center (except for the second command since it's silent), however when I click the notification the event handler isn't triggered.

What I expect from those 3 commands, when my PhoneGap app is in the background:

  1. the first one is supposed to generate a notification with content-available:1, therefore, when I click on the notification, it should trigger the push.on('notification'... handler... well it doesn't. Nothing happens - I click the notification, the app opens and that's it. The event handler isn't triggered.

  2. the second one is a "silent" push notification, without alert, it doesn't trigger the handler either

  3. the last one is a simple alert without content-available, so it isn't supposed to trigger the handler, and well, it doesn't indeed.

Am I doing something wrong? What should I check for? I am new at this but I have spent the past 3 hours looking into the issue, without success.

Thanks for this amazing project and good luck for the future, I'll contribute any way I can.

@thsantac
Copy link

thsantac commented Oct 4, 2016

Hi Macdonst,

It seems I am not alone to face this issue :-)

I have just replaced all the "console.log" by "alert" in push.js (1.8.2), put the new app in background, received a notification, clicked on it. The app is resumed but nothing happens and no alert displayed. If the app was killed before receiving the notification, the app does what I expect it to do.

Still don't know what to do... Please... :-)

@KranthiVallamreddy
Copy link

Hi,
Do we have any update on this? I am facing the same issue as mentioned in this thread. We are planning to release a version of our app to App Store and found this as an issue with our existing functionality to handle push notification. Any suggestion or solution to this issue ASAP will be highly appreciated.

Thank you.

@macdonst
Copy link
Member

@KranthiVallamreddy please comment on #1265 as this issue is closed.

@lock
Copy link

lock bot commented Jun 4, 2018

This thread has been automatically locked.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests