Closed goutamreddy closed 4 years ago
The problem is that we set a default value for alert
if it is not defined.
To remove that default value should be considered a breaking change, because some users may rely on that default.
Could it make sense to add a silent
field to the data
arg, which would always set alert
, badge
and sound
to undefined
?
Added new config property silent
to data
payload.
Released with v1.3.0.
Docs: https://github.com/appfeel/node-pushnotifications#silent-push-notifications
Hi Alexander,
Thanks for fixing this silent push notification issue. I tested and it is working:!
On Thu, Mar 5, 2020 at 12:23 PM Alexander Friedl notifications@github.com wrote:
Added new config property silent to data payload. Released with v1.3.0. Docs: https://github.com/appfeel/node-pushnotifications#silent-push-notifications
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/appfeel/node-pushnotifications/issues/127?email_source=notifications&email_token=ACBUMIIBWSD52JFGPANKCVTRGAC4TA5CNFSM4K5354GKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEN6YOUQ#issuecomment-595429202, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACBUMINV36DBDQAWF3W5JGTRGAC4TANCNFSM4K5354GA .
Hi,
When trying to send a silent push notification for IOS, the "alert" key IS sent, with empty content. I believe this prevents the notification from running code in the background. (https://stackoverflow.com/questions/36694963/what-is-silent-push-notification-when-does-the-device-receive-it).
"For a silent notification, take care to ensure there is no alert, sound, or badge payload in the aps dictionary. If you don’t follow this guidance, the incorrectly-configured notification might be throttled and not delivered to the app in the background, and instead of being silent is displayed to the user" Silent push on IOS requires that NO alert key be sent. The payload looks like this:
but it should look like this:
In testing, with my app suspended in the background due to memory pressure, the silent notification that contains the alert key does not execute code in the background, but rather waits to execute once the app has been woken up by state restoration / user bringing it into foreground.
Here's my setup (IOS 13.1.2, latest node-pushnotifications 1.2.1, node 13.8.0)