-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Parse.Push not silent with push_type="background" on ios #6369
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@funkenstrahlen would you be able to take a look into this? also perhaps this should be moved to the push adapter repo? |
The
(from Apple Documentation) However I think you already know that and only added it for testing. The You are correct Why does it not work for you? In my cloud code it looks like this for a silent notification: return Parse.Push.send({
channels: [ channel ],
data: {
"content-available": 1,
push_type: "background",
payload: payload
}
} Everything inside |
Strange, that's exactly what I have in my code and prompted me to use the dashboard to create an easily replicable example. Here's how it looks in my code, which seems the same as yours.
If I don't enable the "badge" field (or "alert" or "title"), the silent notification just does not arrive to my app running in the foreground. When I enable badge, alert, or title, I see the aps dictionary containing "content-available", but not "push_type". "push_type" is placed outside of aps. I'm using iOS 13.3.1. In google searches for silent notification on iOS, there seems to be a similar issue for various other projects where silent push seems to stop working on iOS 13. They all mention something regarding the "apns-push-type" header field. I wonder if this may be related. Example here rpush/rpush#534 |
Interesting. If you want to make sure the push type is not the cause of the issue you can omit it for notifications to iOS. The Apple documentation states that is is only required for watchOS. On iOS it’s just recommended. So it should work without it. However I can not guarantee the Apple documentation is up to date in this case. We should also check if this is a problem caused by the notification priority. Because a priority lower than 10 does allow the APN to not deliver the notification at all or delay them. |
@taivo Can you please try with a priority of at least 10? |
I know iOS 13 requires the new header key when sending push notifications to APNS. This functionality has been added to Parse Server uses the You can find the code setting the header key here: https://github.com/parse-community/parse-server-push-adapter/blob/c9a1fc65bb61c71adaf4c79df18420c2c6546849/src/APNS.js#L101 I do not know why silent notifications are not sent correctly. However I am sure Parse has already implemented support for the new header key required on iOS 13. |
I believe we already addressed this. Duplicate #6106 The answer should be in there. |
It does (should) work but the documentation is wrong. This is as far as we've got it for the json: data: { object } - Keys below are inside the data object: example json background iOS push:
Perhaps someone will update the parse documentation as it is crucial that this is clear how it should be used, currently it shows that everything should be inside the "data" object but that's not true. Some keys won't be used if those are inside the data object and should be inside the json root as seen above. As seen here: https://docs.parseplatform.org/rest/guide/#sending-pushes |
Issue Description
The issue I encountered can be replicated by using the Push functionality of Parse Dashboard. I'm using parse-server 3.9 on Back4App. The behavior I'm looking for is a silent push that does not trigger a notification on iOS when the app is in the background (or not running), but still receive the payload content to do my own processing when the app is running in the foreground.
Steps to reproduce
Use the Parse Dashboard's json push functionality with the following payload:
When monitoring my phone via Xcode, I can see the following payload being received:
However, because of the "alert" field in the aps dictionary, this push will not be silent when the app is in the background or not running. If we remove the "title" field in the Json payload from Parse Dashboard, the notification does not reach my phone/Xcode, so i'm not able to do custom processing on it while the app is running.
Note that in the received payload, the "push_type" field is outside of the "aps" dictionary instead of inside it. I'm suspecting this may be the issue but currently do not have the right setup to perform a trace/debug.
Is there a way to work around this issue? Right now I'm settling for using a badge updates but true silent notification would be much better. I'm using Back4app and have tried both parse-server 3.9.0 and 3.10 beta, which is the latest available there.
The text was updated successfully, but these errors were encountered: