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

Background Notifications on iOS #109

Closed
alexislg2 opened this issue Sep 6, 2015 · 12 comments
Closed

Background Notifications on iOS #109

alexislg2 opened this issue Sep 6, 2015 · 12 comments

Comments

@alexislg2
Copy link
Contributor

Hey,
I manage to receive notifications in foreground on iOS perfectly but when I send notification when the app is in not running, I receive it in the status bar but when I open the app, the push.on('notification' callback is never called.

Is that normal behaviour?

On Android it is called with data.additionalData.foreground set to false.

@alexislg2
Copy link
Contributor Author

Is that the same issue as this one?
#93

@macdonst
Copy link
Member

macdonst commented Sep 7, 2015

Closing as duplicate of #93

@macdonst macdonst closed this as completed Sep 7, 2015
@slorber
Copy link
Contributor

slorber commented Sep 7, 2015

@macdonst on android when we receive a notification and the app is in background, when clicking on the notification in the statusbar it opens the app and then the notification callback is run.

Isn't something we can expect for iOS too?

I think #93 is talking about receiving the notification without even putting the application in foreground no?

@alexislg2
Copy link
Contributor Author

I was indeed talking about running the callback when the user starts the app from the notification status bar on iOS

There is clearly not the same behaviour on Android (callback is called with foreground option set to true) and on iOS (callback never called)

@slorber
Copy link
Contributor

slorber commented Sep 7, 2015

@alexislg2 you mean callback has foreground=false no?

@macdonst I think is the 2nd case described here.

I also expect the behavior to be the same for Android and iOS in this case (however don't know if this is possible at all).

When receiving an iOS notification while being in background, when opening the notification, the callback should rather be fired otherwise we don't have any way to trigger code on our app.

@alexislg2
Copy link
Contributor Author

@slorber yeah right sorry for the mistake.

It was working properly on the deprecated PushPlugin https://github.com/phonegap-build/PushPlugin

@macdonst
Copy link
Member

@alexislg2 okay, I've re-opened this. The iOS code is based off of the old PushPlugin so I'm wondering what the diff is.

@brickpop
Copy link

+1 here
iOS will launch the app when a notification is opened, but push.on('notification', function(notification){...}) will not fire unless the app is already running (in background or not).

I may have to roll back to the old plugin, if there is no fix for that

@alexislg2
Copy link
Contributor Author

Fixed for me with the commit 9f35486

@slorber
Copy link
Contributor

slorber commented Sep 18, 2015

Related: #117

@macdonst
Copy link
Member

Closing as it appears to be fixed by #117

@lock
Copy link

lock bot commented Jun 5, 2018

This thread has been automatically locked.

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

No branches or pull requests

4 participants