diff --git a/_includes/android/getting-started.md b/_includes/android/getting-started.md index f9e4c4aee..3117b8caa 100644 --- a/_includes/android/getting-started.md +++ b/_includes/android/getting-started.md @@ -9,45 +9,12 @@ Add dependency to the application level `build.gradle` file. ```groovy dependencies { - implementation 'com.parse:parse-android:1.16.7' + implementation 'com.parse:parse-android:latest.version.here' } ``` **Step 2:** Setup Parse - -- **Option 1:** Setup in the Manifest - -You may define `com.parse.SERVER_URL` and `com.parse.APPLICATION_ID` meta-data in your `AndroidManifest.xml`: - -```xml - - - - ... - -``` - -Initializing Parse in the `Application` - -```java -import com.parse.Parse; -import android.app.Application; - -public class App extends Application { - @Override - public void onCreate() { - super.onCreate(); - Parse.initialize(this); - } -} -``` - -- **Option 2:** Setup in the `Application` - +Initialize Parse using your server configuration: ```java import com.parse.Parse; import android.app.Application; @@ -58,6 +25,7 @@ public class App extends Application { super.onCreate(); Parse.initialize(new Parse.Configuration.Builder(this) .applicationId("YOUR_APP_ID") + .clientKey("YOUR_CLIENT_KEY") .server("http://localhost:1337/parse/") .build() ); @@ -65,7 +33,7 @@ public class App extends Application { } ``` - For either option, the custom `Application` class must be registered in `AndroidManifest.xml`: + The custom `Application` class must be registered in `AndroidManifest.xml`: ```xml ``` - -**Step 3:** Setup permissions in the Manifest - -You have to define `INTERNET`permissions in your `AndroidManifest.xml`: - -```xml - - - - - - ... - - -``` diff --git a/_includes/android/push-notifications.md b/_includes/android/push-notifications.md index 6eb449e17..af5538952 100644 --- a/_includes/android/push-notifications.md +++ b/_includes/android/push-notifications.md @@ -8,29 +8,7 @@ If you haven't installed the SDK yet, [head over to the Push QuickStart]({{ site If you want to start using push, start by completing the [Android Push Notifications QuickStart Guide]({{ site.baseUrl }}/parse-server/guide/#push-notifications-quick-start) to learn how to configure your app and send your first push notification. Come back to this guide afterwards to learn more about the push features offered by Parse. -The Parse library provides push notifications using Google Cloud Messaging (GCM) if Google Play Services are available. Learn more about Google Play Services [here](https://developers.google.com/android/guides/overview). - -When sending pushes to Android devices with GCM, there are several pieces of information that Parse keeps track of automatically: - -* **Registration ID**: The GCM registration ID uniquely identifies an app/device pairing for push purposes. -* **Sender ID**: The GCM sender ID is a public number that identifies the sender of a push notification. -* **API key**: The GCM API key is a server secret that allows a server to send pushes to a registration ID on behalf of a particular sender ID. - -The Parse Android SDK now requires you to specify the GCM sender ID with the following `` tag as a child of the `` element in your app's `AndroidManifest.xml`: - -```java -; -``` - -In the sample snippet above, `YOUR_SENDER_ID` should be replaced by a numeric GCM sender ID. Note that the Parse SDK expects you to prefix your sender ID with an `id:` prefix, as shown in the sample snippet. - -If you want to register your app with multiple additional sender IDs, then the `android:value` in the `` element above should hold a comma-delimited list of sender IDs, as in the following snippet: - -```java -; -``` +The Parse library provides push notifications using Firebase Cloud Messaging (FCM) if Google Play Services are available. Learn more about Google Play Services [here](https://firebase.google.com/docs/cloud-messaging/). ## Installations @@ -48,9 +26,8 @@ While it is possible to modify a `ParseInstallation` just like you would a `Pars * **`channels`**: An array of the channels to which a device is currently subscribed. * **`installationId`**: Unique Id for the device used by Parse _(readonly)_. * **`deviceType`**: The type of device, "ios", "osx", "android", "winrt", "winphone", "dotnet", or "embedded". On Android devices, this field will be set to "android" _(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 GCM, this field will be marked "gcm". If Google Play Services is not available, it will be blank _(readonly)_. -* **`GCMSenderId`**: This field only has meaning for Android `ParseInstallation`s that use the GCM push type. It is reserved for directing Parse to send pushes to this installation with an alternate GCM sender ID. This field should generally not be set unless you are uploading installation data from another push provider. If you set this field, then you must set the GCM API key corresponding to this GCM sender ID in your Parse application's push settings. -* **`deviceToken`**: The token used by GCM to keep track of registration ID. On iOS devices, this is the Apple generated token _(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 Google Play Services is not available, it will be blank _(readonly)_. +* **`deviceToken`**: The token used by FCM to keep track of registration ID. On iOS devices, this is a generated token _(readonly)_. * **`appName`**: The display name of the client application to which this installation belongs. This value is synchronized every time a `ParseInstallation` object is saved from the device _(readonly)_. * **`appVersion`**: The version string of the client application to which this installation belongs. This value is synchronized every time a `ParseInstallation` object is saved from the device _(readonly)_. * **`parseVersion`**: The version of the Parse SDK which this installation uses. This value is synchronized every time a `ParseInstallation` object is saved from the device _(readonly)_. @@ -341,7 +318,7 @@ Make sure you've gone through the [Android Push QuickStart]({{ site.baseUrl }}/p When a push notification is received, the “title” is displayed in the status bar and the “alert” is displayed alongside the “title” when the user expands the notification drawer. If you choose to subclass `com.parse.ParsePushBroadcastReceiver`, be sure to replace that name with your class' name in the registration. -Note that some Android emulators (the ones without Google API support) don't support GCM, so if you test your app in an emulator make sure to select an emulator image that has Google APIs installed. +Note that some Android emulators (the ones without Google API support) don't support FCM, so if you test your app in an emulator make sure to select an emulator image that has Google APIs installed. ### Customizing Notifications @@ -520,11 +497,9 @@ You can check the Push Delivery Report for the cause of failed deliveries: Misma If everything looks great so far, but push notifications are not showing up on your phone, there are a few more things you can check. -* [Upgrade to the latest SDK](https://github.com/parse-community/Parse-SDK-Android). This documentation covers the push API introduced in the 1.7.0 version of the Android Parse SDK. Please upgrade if you are getting compiler errors following these instructions. -* Make sure you are using the correct `packageName` in your `AndroidManifest.xml`. -* Make sure you have the correct permissions listed in your `AndroidManifest.xml` file, as outlined in the [Android Push Quickstart]({{ site.baseUrl }}/parse-server/guide/#push-notifications-quick-start). If you are using a a custom receiver, be sure you have registered it in the Manifest file with the correct `android:name` property and the proper intent filters. +* [Upgrade to the latest SDK](https://github.com/parse-community/Parse-SDK-Android). This documentation covers the push API introduced in the 1.17.0 version of the Android Parse SDK. Please upgrade if you are getting compiler errors following these instructions. * Make sure you've used the correct App ID and client key, and that `Parse.initialize()` is being called. `Parse.initialize()` lets the service know which application it is listening for; this code must be in your `Application.onCreate` rather than `Activity.onCreate` for a particular `Activity`, so that any activation technique will know how to use Parse. -* Check that the push registration call is being called successfully. Your device must successfully register a ParseInstallation object with a valid GCM Registration id in the "deviceToken" field, if using GCM. +* Check that the push registration call is being called successfully. Your device must successfully register a ParseInstallation object with a valid FCM Registration id in the "deviceToken" field * Check that the device is set to accept push notifications from your app. * Note that, by design, force-killed apps will not be able to receive push notifications. Launch the app again to reenable push notifications. * Check the number of subscribers in your Parse Push Console. Does it match the expected number of subscribers? Your push might be targeted incorrectly. diff --git a/_includes/dotnet/push-notifications.md b/_includes/dotnet/push-notifications.md index e31d1c86e..8a72d7f03 100644 --- a/_includes/dotnet/push-notifications.md +++ b/_includes/dotnet/push-notifications.md @@ -44,7 +44,7 @@ While it is possible to modify a `ParseInstallation` just like you would a `Pars * **`timeZone`**: The current time zone where the target device is located. This field is readonly and can be accessed via the `TimeZone` property. This value is synchronized every time an `Installation` object is saved from the device. * **`localeIdentifier`**: The locale identifier of the device in the format [language code]-[COUNTRY CODE]. The language codes are two-letter lowercase ISO language codes (such as "en") as defined by [ISO 639-1](http://en.wikipedia.org/wiki/ISO_639-1). The country codes are two-letter uppercase ISO country codes (such as "US") as defined by [ISO 3166-1](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-3). This value is synchronized every time a `ParseInstallation` object is saved from the device _(readonly)_. * **`deviceType`**: The type of device, "ios", "android", "winrt", "winphone", or "dotnet". This field is readonly and can be accessed via the `DeviceType` property. -* **`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 GCM, this field will be marked "gcm". If this device is not using GCM, 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, it will be blank _(readonly)_. * **`installationId`**: Unique Id for the device used by Parse. This field is readonly and can be accessed via the `InstallationId` property. * **`deviceToken`**: The Apple generated token used for iOS devices, or Google generated token used for Android devices _(readonly)_. * **`channelUris`**: The Microsoft-generated push URIs for Windows devices. This field is readonly and can be accessed via the `DeviceUris` property. diff --git a/_includes/ios/push-notifications.md b/_includes/ios/push-notifications.md index 3a744cc4d..af17c8fdb 100644 --- a/_includes/ios/push-notifications.md +++ b/_includes/ios/push-notifications.md @@ -55,7 +55,7 @@ While it is possible to modify a `PFInstallation` just like you would a `PFObjec * **`badge`**: The current value of the icon badge for iOS/OS X apps. Changing this value on the `PFInstallation` will update the badge value on the app icon. Changes should be saved to the server so that they will be used for future badge-increment push notifications. * **`installationId`**: Unique Id for the device used by Parse _(readonly)_. * **`deviceType`**: The type of device, "ios", "osx", "android", "winrt", "winphone", "dotnet", or "embedded". On iOS and OS X devices, this field will be set to "ios" and "osx", respectively _(readonly)_. -* **`deviceToken`**: The Apple generated token used for iOS/OS X devices. On Android devices, this is the token used by GCM to keep track of registration ID _(readonly)_. +* **`deviceToken`**: The Apple generated token used for iOS/OS X devices. On Android devices, this is the token used by FCM to keep track of registration ID _(readonly)_. * **`appName`**: The display name of the client application to which this installation belongs. In iOS/OS X, this value is obtained from `kCFBundleNameKey`. This value is synchronized every time a `PFInstallation` object is saved from the device _(readonly)_. * **`appVersion`**: The version string of the client application to which this installation belongs. In iOS/OS X, this value is obtained from `kCFBundleVersionKey`. This value is synchronized every time a `PFInstallation` object is saved from the device _(readonly)_. * **`appIdentifier`**: A unique identifier for this installation's client application. In iOS/OS X, this value is obtained from `kCFBundleIdentifierKey`. This value is synchronized every time a `PFInstallation` object is saved from the device _(readonly)_. @@ -63,7 +63,6 @@ While it is possible to modify a `PFInstallation` just like you would a `PFObjec * **`timeZone`**: The current time zone where the target device is located. This value is synchronized every time a `PFInstallation` object is saved from the device _(readonly)_. * **`localeIdentifier`**: The locale identifier of the device in the format [language code]-[COUNTRY CODE]. The language codes are two-letter lowercase ISO language codes (such as "en") as defined by [ISO 639-1](http://en.wikipedia.org/wiki/ISO_639-1). The country codes are two-letter uppercase ISO country codes (such as "US") as defined by [ISO 3166-1](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-3). This value is synchronized every time a `PFInstallation` object is saved from the device _(readonly)_. * **`pushType`**: This field is reserved for directing Parse to the push delivery network to be used for Android devices. This parameter is not supported in iOS/OS X devices _(readonly)_. -* **`GCMSenderId`**: This field only has meaning for Android `PFInstallation`s that use the GCM push type. This parameter is not supported in iOS/OS X devices. * **`channelUris`**: The Microsoft-generated push URIs for Windows devices _(readonly)_. The Parse SDK will avoid making unnecessary requests. If a `PFInstallation` is saved on the device, a request to the Parse servers will only be made if one of the `PFInstallation`'s fields has been explicitly updated. diff --git a/_includes/js/push-notifications.md b/_includes/js/push-notifications.md index f7d0d97c1..65fca87ed 100644 --- a/_includes/js/push-notifications.md +++ b/_includes/js/push-notifications.md @@ -26,9 +26,9 @@ 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 GCM, this field will be marked "gcm". If this device is not using GCM, 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 GCM push networks respectively. +* **`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. * **`appName`**: The display name of the client application to which this installation belongs. * **`appVersion`**: The version string of the client application to which this installation belongs. diff --git a/_includes/parse-server/compatibility.md b/_includes/parse-server/compatibility.md index f236a6e6b..cf188bed7 100644 --- a/_includes/parse-server/compatibility.md +++ b/_includes/parse-server/compatibility.md @@ -159,14 +159,6 @@ Push notification support for the Parse IoT SDKs is provided through the Parse P Hosted Parse applications could disable a security setting in order to allow clients to send push notifications. Parse Server does not allow clients to send push notifications as the `masterKey` must be used. Use Cloud Code or the REST API to send push notifications. -### Android: Exporting GCM Registration IDs - -Parse supports sending pushes to Android devices via Google Cloud Messaging (GCM). By default, the GCM registration IDs (stored in the `deviceToken` field) for your app are associated with Parse's GCM sender ID, which won't work after Parse is retired. You may want to take these actions to have your app register with a different GCM sender ID, which will make the registration IDs in the `deviceToken` field exportable to other push providers: - -* Enable GCM for your Android project in the [Google Developer Console](https://console.developers.google.com). Take note of your project number (it should be a large integer like `123427208255`). This is also known as your GCM sender ID. -* Add the `com.parse.push.gcm_sender_id` metadata attribute to your app manifest so that Parse registers for push with your GCM sender ID. For instance, if your GCM sender ID is `123427208255`, then you should add a metadata attribute named `com.parse.push.gcm_sender_id` with the value `id:123427208255` (note that the "id:" prefix is required). This attribute requires Android SDK 1.8.0 or higher. See our [Android push guide]({{ site.baseUrl }}/android/guide/#setting-up-push) for more details on this attribute. -* Parse will now register for GCM with both its GCM sender ID and your GCM sender ID on app startup. You can use the resulting GCM registration IDs (stored in the `deviceToken` field of ParseInstallation) with other GCM push providers. - ## Schema Schema validation is built in. Retrieving the schema via API is available. diff --git a/_includes/parse-server/push-notifications-android.md b/_includes/parse-server/push-notifications-android.md index 54ac2bace..9dea8a2b5 100644 --- a/_includes/parse-server/push-notifications-android.md +++ b/_includes/parse-server/push-notifications-android.md @@ -1,67 +1,48 @@ -#### Configure Broadcast Receiver and Permissions +#### FCM Push Setup -Add the following service and broadcast receiver definitions to `AndroidManifest.xml` immediately before the *closing* `` tag: +Add dependency to the application level `build.gradle` file. -```xml - - - - - - - - - - - - - - - - - - - -; +```groovy +dependencies { + implementation 'com.parse:parse-android-fcm:latest.version.here' +} ``` +Then, follow Google's docs for [setting up an Firebase app](https://firebase.google.com/docs/android/setup). Although the steps are different for setting up FCM with Parse, it is also a good idea to read over the [Firebase FCM Setup](https://firebase.google.com/docs/cloud-messaging/android/client). -Change the `android:name` attribute of `` element above to match your application's package name. - -Change "YOUR_SENDER_ID" to the GCM Sender Id you obtained back in Step 1. See our [Android push guide]({{ site.baseUrl }}/android/guide/#setting-up-push) for more details on this attribute. - -**Migrating a hosted Parse app?** Note that you cannot send GCM pushes to old versions of your app that do not contain the `com.parse.push.gcm_sender_id` attribute in your app manifest, since those versions of the app haven't registered for push using your GCM sender ID. - -Also add the permissions below, typically immediately before the *opening* `` tag: - +You will then need to register some services in your manifest, specifically: +```xml + + + + + +``` +Additional, you will register: ```xml - - - - - - - - - - - + + + + + +``` +After these services are registered in the Manifest, you then need to register the push broadcast receiver: +```xml + + + + + + + ``` -Change the `android:name` attribute in the last two lines of the snippet above to match your application's package name. +## Custom Notifications +If you need to customize the notification that is sent out from a push, you can do so by extending `ParsePushBroadcastReceiver` with your own class and registering it instead in the Manifest. #### Register Device for Push Notifications @@ -105,3 +86,5 @@ curl -X GET \ ``` ##### Proceed to [Step 4](http://docs.parseplatform.org/parse-server/guide/#4-send-push-notifications). + +Note that GCM push support is [deprecated](https://android-developers.googleblog.com/2018/04/time-to-upgrade-from-gcm-to-fcm.html) and FCM should be used instead, but instructions for GCM setup can be found [here](https://github.com/parse-community/Parse-SDK-Android/tree/master/gcm) diff --git a/_includes/parse-server/push-notifications-clients.md b/_includes/parse-server/push-notifications-clients.md deleted file mode 100644 index 8a037978c..000000000 --- a/_includes/parse-server/push-notifications-clients.md +++ /dev/null @@ -1,11 +0,0 @@ -## Configuring your clients to receive Push Notifications - -The following will guide you through the necessary steps to configure your [iOS](#ios-apps) and [Android](#android-apps) client apps to receive push notifications from Parse Server. If you haven't yet, you will first need to prepare your APNS and GCM credentials as documented in [Step 1](#prepare-apns-and-gcm-credentials) of the Push Notifications Quick Start. - -### iOS Apps - -{% include_relative _includes/parse-server/push-notifications-ios.md %} - -### Android apps - -{% include_relative _includes/parse-server/push-notifications-android.md %} diff --git a/_includes/parse-server/push-notifications.md b/_includes/parse-server/push-notifications.md index 59080f7b7..63c638fff 100644 --- a/_includes/parse-server/push-notifications.md +++ b/_includes/parse-server/push-notifications.md @@ -4,7 +4,7 @@ Parse Server provides basic push notification functionality for iOS, macOS, tvOS * Target installations by platform * Target installations by a `ParseQuery` -* Send push notifications to Android devices through [Google Cloud Messaging (GCM)](https://developers.google.com/cloud-messaging/) +* Send push notifications to Android devices through [Firebase Cloud Messaging (FCM)](https://firebase.google.com/docs/cloud-messaging/) * Send push notifications to iOS, tvOS and macOS devices through [Apple Push Notification Service (APNS)](https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/APNSOverview.html#//apple_ref/doc/uid/TP40008194-CH8-SW1) * Use most of the sending options @@ -36,21 +36,17 @@ Here is the list of sending options we do not support yet: ## Push Notifications Quick Start -### 1. Prepare APNS and GCM Credentials +### 1. Prepare APNS and FCM Credentials -You will need to obtain some credentials from GCM and APNS in order to send push notifications. +You will need to obtain some credentials from FCM and APNS in order to send push notifications. #### APNS (iOS) If you are setting up push notifications on iOS, tvOS or macOS for the first time, we recommend you visit the [raywenderlich.com's Push Notifications tutorial](https://www.raywenderlich.com/123862/push-notifications-tutorial) or [appcoda.com's iOS Push tutorial](https://www.appcoda.com/push-notification-ios/) to help you obtain a production Apple Push Certificate. Parse Server supports the PFX (`.p12`) file exported from Keychain Access. Parse Server also supports the push certificate and key in `.pem` format. Token-based authentication instead of a certificate is supported as well. -#### GCM (Android) +#### FCM (Android) -To get your GCM sender ID, enable GCM for your Android project in the [Google Developer Console](https://console.developers.google.com). Take note of your project number. It should be a large integer like 123427208255. This project number is your GCM sender ID. - -To get your GCM API key, go to the [Google developer credentials](https://console.developers.google.com/apis/credentials) page, and either create a new API key or reuse an existing one. - -By default, the hosted Parse service (parse.com) sends pushes to your Android app with its own GCM sender ID. With your Parse Server, this setup will no longer work. Instead, your Parse Server will send GCM pushes with its own GCM sender ID and API key. You should register a GCM sender ID and update your app as soon as possible. Until users update, you can continue sending push notifications through Parse.com. +To get your FCM API key, go to the [Firebase console](https://console.developers.google.com/apis/credentials) and navigate to the project. Navigate to the settings of the project, and within the "Cloud Messaging" tab, you will find it, labeled "Server key" ### 2. Configure Parse Server @@ -64,7 +60,6 @@ var server = new ParseServer({ masterKey: '...', push: { android: { - senderId: '...', apiKey: '...' }, ios: { @@ -82,8 +77,7 @@ The configuration format is ```js push: { android: { - senderId: '', // The Sender ID of GCM - apiKey: '' // The Server API Key of GCM + apiKey: '' // The Server API Key of FCM }, ios: { pfx: '', // The filename of private key and certificate in PFX or PKCS12 format from disk @@ -141,7 +135,6 @@ var server = new ParseServer({ masterKey: '...', push: { android: { - senderId: '...', apiKey: '...' }, ios: { @@ -237,7 +230,7 @@ After sending this to your Parse Server, you should see the push notifications s In your Parse Server logs, you can see something similar to ```json -GCM request and response {"request":{"params":{"priority":"normal","data":{"time":"2016-02-10T03:21:59.065Z","push_id":"NTDgWw7kp8","data":"{\"alert\":\"All work and no play makes Jack a dull boy.\"}"}}},"response":{"multicast_id":5318039027588186000,"success":1,"failure":0,"canonical_ids":0,"results":[{"registration_id":"APA91bEdLpZnXT76vpkvkD7uWXEAgfrZgkiH_ybkzXqhaNcRw1KHOY0s9GUKNgneGxe2PqJ5Swk1-Vf852kpHAP0Mhoj5wd1MVXpRsRr_3KTQo_dkNd_5wcQ__yWnWLxbeM3kg_JziJK","message_id":"0:1455074519347821%df0f8ea7f9fd7ecd"}]}} +FCM request and response {"request":{"params":{"priority":"normal","data":{"time":"2016-02-10T03:21:59.065Z","push_id":"NTDgWw7kp8","data":"{\"alert\":\"All work and no play makes Jack a dull boy.\"}"}}},"response":{"multicast_id":5318039027588186000,"success":1,"failure":0,"canonical_ids":0,"results":[{"registration_id":"APA91bEdLpZnXT76vpkvkD7uWXEAgfrZgkiH_ybkzXqhaNcRw1KHOY0s9GUKNgneGxe2PqJ5Swk1-Vf852kpHAP0Mhoj5wd1MVXpRsRr_3KTQo_dkNd_5wcQ__yWnWLxbeM3kg_JziJK","message_id":"0:1455074519347821%df0f8ea7f9fd7ecd"}]}} ``` ```json @@ -245,11 +238,11 @@ APNS Connected APNS Notification transmitted to:7a7d2864598e1f65e6e02135245b7daf8ea510514e6376f072dc29d53facaa41 ``` -These logs mean that the GCM and APNS connections are working. +These logs mean that the FCM and APNS connections are working. ## Push Adapter -Parse Server provides a `PushAdapter` which abstracts the way we actually send push notifications. The default implementation is `ParsePushAdapter`, which uses GCM for Android push and APNS for iOS push. However, if you want to use other push providers, you can implement your own `PushAdapter`. Your adapter needs to implement `send(data, installations)`, which is used for sending data to the installations. You can use `ParsePushAdapter` as a reference. After you implement your `PushAdapter`, you can pass that instance to Parse Server like this +Parse Server provides a `PushAdapter` which abstracts the way we actually send push notifications. The default implementation is `ParsePushAdapter`, which uses FCM for Android push and APNS for iOS push. However, if you want to use other push providers, you can implement your own `PushAdapter`. Your adapter needs to implement `send(data, installations)`, which is used for sending data to the installations. You can use `ParsePushAdapter` as a reference. After you implement your `PushAdapter`, you can pass that instance to Parse Server like this ```js var server = new ParseServer({ diff --git a/_includes/rest/push-notifications.md b/_includes/rest/push-notifications.md index a2d3fe869..4a6f4a725 100644 --- a/_includes/rest/push-notifications.md +++ b/_includes/rest/push-notifications.md @@ -14,10 +14,9 @@ An installation object represents an instance of your app being installed on a d * **`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 should be an [IANA time zone identifier](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). * **`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 GCM, this field will be marked "gcm". If this device is not using GCM, and is using Parse's push notification service, it will be blank _(readonly)_. -* **`GCMSenderId`**: This field only has meaning for Android installations that use the GCM push type. It is reserved for directing Parse to send pushes to this installation with an alternate GCM sender ID. This field should generally not be set unless you are uploading installation data from another push provider. If you set this field, then you must set the GCM API key corresponding to this GCM sender ID in your Parse application's push settings. +* **`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 GCM push networks respectively. +* **`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. * **`appName`**: The display name of the client application to which this installation belongs. * **`appVersion`**: The version string of the client application to which this installation belongs. @@ -77,12 +76,11 @@ The response body is a JSON object containing the `objectId` and the `createdAt` } -When creating Android installation objects containing GCM (Google Cloud Messaging) credentials, you must have at least the following fields in your installation object: +When creating Android installation objects containing FCM (Firebase Cloud Messaging) credentials, you must have at least the following fields in your installation object: * A `deviceType` set to `android`. * A `pushType` set to `gcm`. -* A GCM registration ID in the `deviceToken` field. -* The GCM sender ID associated with this registration ID in the `GCMSenderId` field. +* A FCM registration token in the `deviceToken` field. You could create and object with these fields using a command like this: @@ -95,7 +93,6 @@ curl -X POST \ "deviceType": "android", "pushType": "gcm", "deviceToken": "APA91bFMvbrGg4cp3KUV_7dhU1gmwE_...", - "GCMSenderId": "56712320625545", "channels": [ "" ] @@ -110,7 +107,6 @@ connection.request('POST', '/parse/ -If you upload Android installations with GCM credentials, then you must also set the GCM API Key associated with this GCM sender ID in your application's push settings. - ### Retrieving Installations You can retrieve the contents of an installation object by sending a GET request to the URL returned in the location header when it was created. For example, to retrieve the installation created above: diff --git a/_includes/unity/push-notifications.md b/_includes/unity/push-notifications.md index 9ee021a7e..12eabf4bb 100644 --- a/_includes/unity/push-notifications.md +++ b/_includes/unity/push-notifications.md @@ -5,7 +5,7 @@ Push Notifications are a great way to keep your users engaged and informed about If you haven't installed the SDK yet, please [head over to the Push QuickStart]({{ site.baseUrl }}/parse-server/guide/#push-notifications-quick-start) to get our SDK up and running.
-The Unity SDK can send push notifications from all runtimes, but only iOS and Android apps can receive pushes from APNS and GCM push servers. +The Unity SDK can send push notifications from all runtimes, but only iOS and Android apps can receive pushes from APNS and FCM push servers.
## Setting Up Push @@ -29,8 +29,7 @@ While it is possible to modify a `ParseInstallation` just like you would a `Pars * **`timeZone`**: The current time zone where the target device is located. This field is readonly and can be accessed via the `TimeZone` property. This value is synchronized every time an `Installation` object is saved from the device. * **`localeIdentifier`**: The locale identifier of the device in the format [language code]-[COUNTRY CODE]. The language codes are two-letter lowercase ISO language codes (such as "en") as defined by [ISO 639-1](http://en.wikipedia.org/wiki/ISO_639-1). The country codes are two-letter uppercase ISO country codes (such as "US") as defined by [ISO 3166-1](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-3). This value is synchronized every time a `ParseInstallation` object is saved from the device _(readonly)_. * **`deviceType`**: The type of device, "ios", "android", "winrt", "winphone", or "dotnet". This field is readonly and can be accessed via the `DeviceType` property. -* **`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 GCM, this field will be marked "gcm". If this device is not using GCM, and is using Parse's push notification service, it will be blank _(readonly)_. -* **`installationId`**: Unique Id for the device used by Parse. This field is readonly and can be accessed via the `InstallationId` property. +* **`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`**: Unique Id for the device used by Parse. This field is readonly and can be accessed via the `InstallationId` property. * **`channelUris`**: The Microsoft-generated push URIs for Windows devices. This field is readonly and can be accessed via the `DeviceUris` property. * **`appName`**: The display name of the client application to which this installation belongs. This field is readonly and can be accessed via the `AppName` property.