phonegap / phonegap-plugin-push

Register and receive push notifications
MIT License
1.94k stars 1.91k forks source link

[iOS] on('notification') event does not trigger when app is foreground with screen locked #2882

Open roxteddy opened 4 years ago

roxteddy commented 4 years ago

Expected Behaviour

.on('notification') should trigger when opening notification

Actual Behaviour

it does not trigger when opening notification from lockscreen and app is foreground

Reproduce Scenario (including but not limited to)

Steps to Reproduce

Platform and Version (eg. Android 5.0 or iOS 9.2.1)

iOS 13.3.1

Cordova CLI version and cordova platform version

cordova 9.0.0 cordova ios 5.0.1

Plugin version

2.3.0

Sample Push Data Payload

any

alexstanbury commented 4 years ago

To add to this, I am only seeing this behaviour when I have a passcode or fingerprint set on the device, and once that step is completed the app will be open but the .on('notification') handler is not called. Interestingly if I don't have passcode or fingerprint set then the app opens as expected and handler is called.

I should also add that the handler is called correctly with or without security if the app is in a forced closed state when the notification is tapped.

Additionally, everything works as expected on my Android device.

Platform and Version (eg. Android 5.0 or iOS 9.2.1) iOS 13.3.1

Cordova CLI version and cordova platform version cordova 9.0.0 cordova ios 5.1.1

Plugin version 2.3.0

Sample Push Data Payload any

roxteddy commented 4 years ago

I should also add that the handler is called correctly with or without security if the app is in a forced closed state when the notification is tapped.

My bug happens when app is foreground behind the lock screen. Can't be closed at the same time.

Does yours happen when app is not force closed but not foreground ?

alexstanbury commented 4 years ago

@roxteddy Yes that's when I was experiencing the issue.

I've actually moved over to https://github.com/dpa99c/cordova-plugin-firebasex which does not have the issue, is updated regularly and in my opinion has a more intuitive API and much clearer documentation, so I'd recommend making the switch to that if you can.

aml25 commented 4 years ago

@alexstanbury yeah but that plugin is GIGANTIC! When I migrated it takes like 10 minutes to build on iOS. I had to dump it from all the dependencies and size and warnings during build.

I actually really like interfacing with this plugin (phongap-plugin-push) but I can't get it to work at all on iOS - a different topic/issue.