Skip to content
This repository was archived by the owner on Jun 24, 2025. It is now read-only.

Commit ec20810

Browse files
committed
Added FCM support.
1 parent 39c290b commit ec20810

25 files changed

+525
-97
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,5 @@ proguard/
3636
atlassian-ide-plugin.xml
3737

3838
# Meld mergetool files
39-
*.orig
39+
*.orig
40+

CHANGELOG.MD

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,7 @@ First release of the GCM Push Client.
1010
+ Added Bintray plugin for gradle.
1111
+ Fixed GCM.unregister() method deprecation by creating an UnregisterService.
1212
+ Fixed GCM.MESSAGE_TYPE_MESSAGE constant deprecation by creating a class that extends GcmListenerService.
13+
14+
## [1.1.1](https://github.com/devsu/gcm-push-client/releases/tag/1.1.1) (2016-08-24)
15+
16+
+ Added FCM support.

README.MD

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,28 @@ Using GCM Push Client is very simple. You can import GCM Push Client on your bui
88

99
```
1010
// Remember to add your GCM Play Services dependency!
11-
compile 'com.google.android.gms:play-services-gcm:8.4.0'
12-
compile 'com.devsu:pushclient:1.1.0'
11+
compile 'com.google.android.gms:play-services-gcm:9.4.0'
12+
13+
// Or if you're using FCM, import the FCM dependency!
14+
compile 'com.google.firebase:firebase-messaging:9.4.0'
15+
16+
compile 'com.devsu:pushclient:1.1.1'
1317
```
1418

15-
Then, initialize the library on your Application, and that's it!
19+
Add the com.google.gms.google-services plugin, and then, initialize the library on your Application. That's it!
1620

1721
```java
1822
public class MyApplication extends Application {
1923
@Override
2024
public void onCreate() {
2125
super.onCreate();
2226
...
27+
28+
// FCM is selected by default
2329
PushClient.initialize(this, "MY_GCM_ID");
30+
31+
// Or GCM
32+
PushClient.initialize(this, Provider.GCM, "MY_GCM_ID");
2433
}
2534
}
2635
```
@@ -88,7 +97,7 @@ public class MyApplication extends Application {
8897
public void onCreate() {
8998
super.onCreate();
9099
...
91-
PushClient.initialize(this, "MY_GCM_ID", new ToastDelegate(this));
100+
PushClient.initialize(this, Provider.GCM, "MY_GCM_ID", new ToastDelegate(this));
92101
}
93102
}
94103
```
@@ -103,7 +112,7 @@ public class MyApplication extends Application {
103112
public void onCreate() {
104113
super.onCreate();
105114
...
106-
PushClient.initialize(this, "MY_GCM_ID");
115+
PushClient.initialize(this, Provider.FCM, "MY_GCM_ID");
107116
SimpleNotificationDelegate delegate = (SimpleNotificationDelegate) PushClient.getDelegate();
108117

109118
// Change the large icon

build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ buildscript {
55
jcenter()
66
}
77
dependencies {
8-
classpath 'com.android.tools.build:gradle:1.5.0'
9-
classpath 'com.google.gms:google-services:1.5.0-beta2'
10-
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.4'
11-
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
8+
classpath 'com.android.tools.build:gradle:2.1.3'
9+
classpath 'com.google.gms:google-services:3.0.0'
10+
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7'
11+
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
1212
}
1313
}
1414

pushclient/build.gradle

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
apply plugin: 'com.android.library'
22

33
android {
4-
compileSdkVersion 23
5-
buildToolsVersion "23.0.2"
4+
compileSdkVersion 24
5+
buildToolsVersion "23.0.3"
66

77
defaultConfig {
88
minSdkVersion 12
9-
targetSdkVersion 23
10-
versionCode 1
11-
versionName "1.1.0"
9+
targetSdkVersion 24
10+
versionCode 2
11+
versionName "1.1.1"
1212
}
1313

1414
buildTypes {
@@ -141,6 +141,7 @@ bintray {
141141
dependencies {
142142
compile fileTree(dir: 'libs', include: ['*.jar'])
143143
testCompile 'junit:junit:4.12'
144-
compile 'com.android.support:appcompat-v7:23.1.1'
145-
compile 'com.google.android.gms:play-services-gcm:8.4.0'
144+
compile 'com.android.support:appcompat-v7:24.2.0'
145+
compile 'com.google.android.gms:play-services-gcm:9.4.0'
146+
compile "com.google.firebase:firebase-messaging:9.0.0"
146147
}

pushclient/src/main/AndroidManifest.xml

Lines changed: 42 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
22
package="com.devsu.library.pushclient">
33

4-
<permission android:name=".permission.C2D_MESSAGE" android:protectionLevel="signature"/>
5-
<uses-permission android:name=".permission.C2D_MESSAGE" />
6-
7-
84
<uses-permission android:name="android.permission.VIBRATE" />
95
<uses-permission android:name="android.permission.INTERNET" />
106
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
@@ -28,29 +24,63 @@
2824
</receiver>
2925

3026
<service
31-
android:name=".service.PushListenerService"
32-
android:exported="false" >
27+
android:name=".service.gcm.GcmPushListenerService"
28+
android:exported="false"
29+
android:enabled="false">
3330
<intent-filter>
3431
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
3532
</intent-filter>
3633
</service>
3734

3835
<service
39-
android:name=".service.IdListenerService"
40-
android:exported="false">
36+
android:name=".service.firebase.FirebasePushListenerService"
37+
android:exported="false"
38+
android:enabled="false">
39+
<intent-filter>
40+
<action android:name="com.google.firebase.MESSAGING_EVENT" />
41+
</intent-filter>
42+
</service>
43+
44+
<service
45+
android:name=".service.gcm.GcmIdListenerService"
46+
android:exported="false"
47+
android:enabled="false">
4148
<intent-filter>
4249
<action android:name="com.google.android.gms.iid.InstanceID" />
4350
</intent-filter>
4451
</service>
4552

4653
<service
47-
android:name=".service.RegistrationIntentService"
48-
android:exported="false">
54+
android:name=".service.firebase.FirebaseIdListenerService"
55+
android:exported="false"
56+
android:enabled="false">
57+
<intent-filter>
58+
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
59+
</intent-filter>
60+
</service>
61+
62+
<service
63+
android:name=".service.gcm.GcmRegistrationIntentService"
64+
android:exported="false"
65+
android:enabled="false">
66+
</service>
67+
68+
<service
69+
android:name=".service.firebase.FirebaseRegistrationIntentService"
70+
android:exported="false"
71+
android:enabled="false">
72+
</service>
73+
74+
<service
75+
android:name=".service.gcm.GcmUnregistrationIntentService"
76+
android:exported="false"
77+
android:enabled="false">
4978
</service>
5079

5180
<service
52-
android:name=".service.UnregistrationIntentService"
53-
android:exported="false">
81+
android:name=".service.firebase.FirebaseUnregistrationIntentService"
82+
android:exported="false"
83+
android:enabled="false">
5484
</service>
5585

5686
</application>

0 commit comments

Comments
 (0)