From d4f7b157b45f2e69b3a3b70a70a8978a13efd377 Mon Sep 17 00:00:00 2001 From: Roger Hu Date: Fri, 4 May 2018 10:13:10 -0700 Subject: [PATCH] Fix README --- README.md | 74 ++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 63 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index c8b048b83..8560482a5 100644 --- a/README.md +++ b/README.md @@ -12,26 +12,73 @@ A library that gives you access to the powerful Parse cloud platform from your A For more information about Parse and its features, see [the website][parseplatform.org], [blog][blog] and [getting started][guide]. ## Getting Started + ### Installation - **Option 1:** Gradle Add dependency to the application level `build.gradle` file. + ```groovy + ext { + parseVersion = "1.17.0" + } + ``` + ```groovy dependencies { - implementation 'com.parse:parse-android:1.16.7' + implementation "com.parse:parse-android:$parseVersion" + + // Add for push notification support -- add FCM or GCM but not both. + implementation "com.parse:parse-fcm-android:$parseVersion" // migrate to FCM + // implementation "com.parse:parse-gcm-android:$parseVersion" // deprecated GCM support + } ``` + #### Migrating to Firebase + + If you are upgrading from a previous Parse SDK version and rely on push notifications, it is highly recommended you migrate to Firebase Cloud Messaging (FCM) since Google has announced it will be deprecated in April 2019. To migrate to FCM, you will only need to make changes to the client. No changes are needed on the Parse Server side. + + Verify you have done the following: + + - [ ] Added app to [Firebase console](https://console.firebase.google.com/u/0/). + - [ ] Added the `com.google.gms.google-services` Gradle plugin (see [setup guide](https://firebase.google.com/docs/android/setup)) + + ```groovy + buildscript { + // ... + dependencies { + // ... + classpath 'com.google.gms:google-services:3.2.1' // google-services plugin + } + } + + allprojects { + // ... + repositories { + // ... + maven { + google() // Google's Maven repository + } + } + } + ``` + + - [ ] Downloaded and added [google-services.json](https://support.google.com/firebase/answer/7015592) to your `app/` dir from your Firebase app. + - [ ] Added `ParseFirebaseInstanceIdService` and `ParseFirebaseMessagingService` to your `AndroidManifest.xml` file (see [docs](http://docs.parseplatform.org/tutorials/android-push-notifications/)) + - [ ] Removed `GcmBroadcastReceiver`, `PushService`, `com.parse.push.gcm_sender_id` if upgrading from GCM. + + Assuming these major steps are done, adding the `parse-fcm-android` package will automatically instantiate a [ParseFirebaseJobService](https://github.com/parse-community/Parse-SDK-Android/blob/master/fcm/src/main/java/com/parse/fcm/ParseFirebaseJobService.java) that will register for a FCM token when the app starts. See the setup instructions below to verify that FCM registration works. + - **Option 2:** Compiling for yourself into AAR file If you want to manually compile the SDK, begin by cloning the repository locally or retrieving the source code for a particular [release][releases]. Open the project in Android Studio and run the following commands in the Terminal of Android Studio: - + ``` ./gradlew clean build ``` Output file can be found in `Parse/build/outputs/` with extension .aar - + You can link to your project to your AAR file as you please. @@ -45,6 +92,11 @@ Initialize Parse in a custom class that extends `Application`: @Override public void onCreate() { super.onCreate(); + + // Remove for production, use to verify FCM is working + // Look for ParseFCM: FCM registration success messages in Logcat to confirm. + Parse.setLogLevel(Parse.LOG_LEVEL_DEBUG); + Parse.initialize(new Parse.Configuration.Builder(this) .applicationId("YOUR_APP_ID") .clientKey("YOUR_CLIENT_KEY") @@ -54,9 +106,9 @@ Initialize Parse in a custom class that extends `Application`: } } ``` - + The custom `Application` class must be registered in `AndroidManifest.xml`: - + ```xml