Skip to content

Commit b4beae3

Browse files
rogerhuJawnnypoo
authored andcommitted
Fix ParseGCM so that it works (#817)
1 parent 256b955 commit b4beae3

File tree

3 files changed

+7
-14
lines changed

3 files changed

+7
-14
lines changed

build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ ext {
3030

3131
supportLibVersion = '27.1.1'
3232
googleLibVersion = '15.0.0'
33+
googleLibVersionGCM = '12.0.1' // last version for GCM to be supported
34+
3335
firebaseJobdispatcherVersion = '0.8.5'
3436

3537
minSdkVersion = 14

gcm/README.md

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -68,21 +68,12 @@ After these services are registered in the Manifest, you then need to register y
6868
</intent-filter>
6969
</receiver>
7070
```
71-
After all this, you will need to register for GCM in your `Application.onCreate()`, like so:
71+
72+
After this, you are all set. Adding the `parse-gcm-android` package will include a [ParseGCMJobService](https://github.com/parse-community/Parse-SDK-Android/blob/master/gcm/src/main/java/com/parse/gcm/ParseGCMJobService.java) in the `AndroidManifest.xml` file that will register for a GCM token when the app starts. You should see `ParseGCM: GCM registration success` messages assuming you have enabled logging:
73+
7274
```java
73-
@Override
74-
public void onCreate() {
75-
super.onCreate();
76-
Parse.Configuration configuration = new Parse.Configuration.Builder(this)
77-
//...
78-
.build();
79-
Parse.initialize(configuration);
80-
ParseGCM.register(this);
81-
}
75+
Parse.setLogLevel(Parse.LOG_LEVEL_DEBUG);
8276
```
83-
The sender ID should be all numbers. It is obtained via the Firebase console.
84-
85-
After this, you are all set.
8677

8778
## Custom Notifications
8879
If you need to customize the notification that is sent out from a push, you can do so easily by extending `ParsePushBroadcastReceiver` with your own class and registering it instead in the Manifest.

gcm/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ android {
4141
}
4242

4343
dependencies {
44-
api "com.google.android.gms:play-services-gcm:$googleLibVersion"
44+
api "com.google.android.gms:play-services-gcm:$googleLibVersionGCM"
4545
api "com.firebase:firebase-jobdispatcher:$firebaseJobdispatcherVersion"
4646
implementation project(':Parse')
4747
}

0 commit comments

Comments
 (0)