From 2ce4b8170bdb5fa4c7697258a5415fc88a9bb863 Mon Sep 17 00:00:00 2001 From: Stefan Trauth Date: Sat, 13 Jul 2019 15:53:16 +0200 Subject: [PATCH 1/4] document push type and priority keys for notifications --- _includes/parse-server/push-notifications.md | 4 ++++ _includes/rest/push-notifications.md | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/_includes/parse-server/push-notifications.md b/_includes/parse-server/push-notifications.md index 324d02a60..a953afaeb 100644 --- a/_includes/parse-server/push-notifications.md +++ b/_includes/parse-server/push-notifications.md @@ -20,6 +20,8 @@ We support most of the sending options. Check the detailed doc [here]({{ site.ba * `channels` to target installations by channels * `where` to target installations by `ParseQuery` +* `priority` for iOS push priority +* `push_type` for iOS push type * `alert` under `data` for notification message * number `badge` under `data` for iOS badge number * `sound` under `data` for iOS sound @@ -284,6 +286,8 @@ If you're interested in any of these features, [don't hesitate to jump in and se If you are seeing situations where silent notifications are failing to deliver, please ensure that your payload is setting the `content-available` attribute to Int(1) (or just 1 as in javascript) and not "1". This value will be explicitly checked. +When sending a push notification to APNs you also have to set `push_type` to `background` for delivering silent notifications to devices running iOS 13 and later, or watchOS 6 or later. + ### PPNS * [PPNS Protocol Specification (for Parse IoT devices)](https://github.com/parse-community/parse-server/wiki/PPNS-Protocol-Specification) diff --git a/_includes/rest/push-notifications.md b/_includes/rest/push-notifications.md index 500e7f65c..22dc9c830 100644 --- a/_includes/rest/push-notifications.md +++ b/_includes/rest/push-notifications.md @@ -620,7 +620,9 @@ If you want to send more than just a message, you can set other fields in the `d * **`alert`**: the notification's message. * **`badge`**: _(iOS only)_ the value indicated in the top right corner of the app icon. This can be set to a value or to `Increment` in order to increment the current value by 1. * **`sound`**: _(iOS only)_ the name of a sound file in the application bundle. -* **`content-available`**: _(iOS only)_ If you are a writing an app using the Remote Notification Background Mode [introduced in iOS7](https://developer.apple.com/library/ios/releasenotes/General/WhatsNewIniOS/Articles/iOS7.html#//apple_ref/doc/uid/TP40013162-SW10) (a.k.a. "Background Push"), set this value to 1 to trigger a background download. +* **`content-available`**: _(iOS only)_ If you are a writing an app using the Remote Notification Background Mode [introduced in iOS7](https://developer.apple.com/library/ios/releasenotes/General/WhatsNewIniOS/Articles/iOS7.html#//apple_ref/doc/uid/TP40013162-SW10) (a.k.a. "Background Push"), set this value to 1 to trigger a background download. You also have to set `push_type` starting iOS 13 and watchOS 6. +* **`push_type`**: _(iOS only)_ The type of the notification. The value is `alert` or `background`. Specify `alert` when the delivery of your notification displays an alert, plays a sound, or badges your app's icon. Specify `background` for silent notifications that do not interact with the user. Defaults to `alert` if no value is set. Required when delivering notifications to devices running iOS 13 and later, or watchOS 6 and later. +* **`priority`**: _(iOS only)_ The priority of the notification. Specify 10 to send the notification immediately. Specify 5 to send the notification based on power considerations on the user’s device. ([More detailed documentation](https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/sending_notification_requests_to_apns)) * **`category`**: _(iOS only)_ the identifier of the [`UNNotification​Category`](https://developer.apple.com/reference/usernotifications/unnotificationcategory) for this push notification. * **`uri`**: _(Android only)_ an optional field that contains a URI. When the notification is opened, an `Activity` associated with opening the URI is launched. * **`title`**: _(Android only)_ the value displayed in the Android system tray notification. From 40c5c320e2da716a988b08c62b89a222b1b611de Mon Sep 17 00:00:00 2001 From: Stefan Trauth Date: Sat, 13 Jul 2019 16:11:19 +0200 Subject: [PATCH 2/4] priority and push type are also part of the data key --- _includes/parse-server/push-notifications.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_includes/parse-server/push-notifications.md b/_includes/parse-server/push-notifications.md index a953afaeb..93aa34f03 100644 --- a/_includes/parse-server/push-notifications.md +++ b/_includes/parse-server/push-notifications.md @@ -20,8 +20,8 @@ We support most of the sending options. Check the detailed doc [here]({{ site.ba * `channels` to target installations by channels * `where` to target installations by `ParseQuery` -* `priority` for iOS push priority -* `push_type` for iOS push type +* `priority` under `data` for iOS push priority +* `push_type` under `data` for iOS push type * `alert` under `data` for notification message * number `badge` under `data` for iOS badge number * `sound` under `data` for iOS sound From 19f8562b67c5ce2577dc9b8d6fa7d0f549b63a93 Mon Sep 17 00:00:00 2001 From: Stefan Trauth Date: Sun, 14 Jul 2019 11:59:14 +0200 Subject: [PATCH 3/4] refactor: fix markdown syntax --- _includes/js/push-notifications.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_includes/js/push-notifications.md b/_includes/js/push-notifications.md index 1ea7a2c32..a9531c5fe 100644 --- a/_includes/js/push-notifications.md +++ b/_includes/js/push-notifications.md @@ -26,7 +26,7 @@ This class has several special fields that help you manage and target devices. * **`channels`**: An array of the channels to which a device is currently subscribed. * **`timeZone`**: The current time zone where the target device is located. This value is synchronized every time an `Installation` object is saved from the device. * **`deviceType`**: The type of device, "ios", "android", "winrt", "winphone", or "dotnet"_(readonly)_. -* **`pushType`**: This field is reserved for directing Parse to the push delivery network to be used. If the device is registered to receive pushes via FCM, this field will be marked "gcm". If this device is not using FCM, and is using Parse's push notification service, it will be blank _(readonly)_. +* **`pushType`**: This field is reserved for directing Parse to the push delivery network to be used. If the device is registered to receive pushes via FCM, this field will be marked "gcm". If this device is not using FCM, and is using Parse's push notification service, it will be blank _(readonly)_. * **`installationId`**: Universally Unique Identifier (UUID) for the device used by Parse. It must be unique across all of an app's installations. _(readonly)_. * **`deviceToken`**: The Apple or Google generated token used to deliver messages to the APNs or FCM push networks respectively. * **`channelUris`**: The Microsoft-generated push URIs for Windows devices. @@ -129,7 +129,7 @@ Parse.Push.send({ If we store relationships to other objects in our `Installation` class, we can also use those in our query. For example, we could send a push notification to all users near a given location like this. - ```javascript +```javascript // Find users near a given location var userQuery = new Parse.Query(Parse.User); userQuery.withinMiles("location", stadiumLocation, 1.0); From defb4caabdfe5253710242a62320701c86930015 Mon Sep 17 00:00:00 2001 From: Stefan Trauth Date: Sun, 14 Jul 2019 11:59:44 +0200 Subject: [PATCH 4/4] add push type and priority key to JS docs --- _includes/js/push-notifications.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/_includes/js/push-notifications.md b/_includes/js/push-notifications.md index a9531c5fe..d18745236 100644 --- a/_includes/js/push-notifications.md +++ b/_includes/js/push-notifications.md @@ -163,7 +163,9 @@ If you want to send more than just a message, you can set other fields in the `d * **`alert`**: the notification's message. * **`badge`**: _(iOS only)_ the value indicated in the top right corner of the app icon. This can be set to a value or to `Increment` in order to increment the current value by 1. * **`sound`**: _(iOS only)_ the name of a sound file in the application bundle. -* **`content-available`**: _(iOS only)_ If you are a writing an app using the Remote Notification Background Mode [introduced in iOS7](https://developer.apple.com/library/ios/releasenotes/General/WhatsNewIniOS/Articles/iOS7.html#//apple_ref/doc/uid/TP40013162-SW10) (a.k.a. "Background Push"), set this value to 1 to trigger a background download. +* **`content-available`**: _(iOS only)_ If you are a writing an app using the Remote Notification Background Mode [introduced in iOS7](https://developer.apple.com/library/ios/releasenotes/General/WhatsNewIniOS/Articles/iOS7.html#//apple_ref/doc/uid/TP40013162-SW10) (a.k.a. "Background Push"), set this value to 1 to trigger a background download. You also have to set `push_type` starting iOS 13 and watchOS 6. +* **`push_type`**: _(iOS only)_ The type of the notification. The value is `alert` or `background`. Specify `alert` when the delivery of your notification displays an alert, plays a sound, or badges your app's icon. Specify `background` for silent notifications that do not interact with the user. Defaults to `alert` if no value is set. Required when delivering notifications to devices running iOS 13 and later, or watchOS 6 and later. +* **`priority`**: _(iOS only)_ The priority of the notification. Specify 10 to send the notification immediately. Specify 5 to send the notification based on power considerations on the user’s device. ([More detailed documentation](https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/sending_notification_requests_to_apns)) * **`category`**: _(iOS only)_ the identifier of the [`UNNotification​Category`](https://developer.apple.com/reference/usernotifications/unnotificationcategory) for this push notification. * **`uri`**: _(Android only)_ an optional field that contains a URI. When the notification is opened, an `Activity` associated with opening the URI is launched. * **`title`**: _(Android only)_ the value displayed in the Android system tray notification.