Skip to content
This repository has been archived by the owner on Sep 4, 2020. It is now read-only.

Commit

Permalink
Added partial Android FCM support (#975)
Browse files Browse the repository at this point in the history
* Modified plugin.xml to include FCM changes

* Plugin.xml changes for FCM

* Java changes for FCM

* Increased plugin version to 2.0.0

* Increased plugin version in package.json

* Added topic subscription/unsubscription

* Removed some empty lines
  • Loading branch information
jcesarmobile authored and macdonst committed May 23, 2017
1 parent df61d02 commit 1887154
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
18 changes: 15 additions & 3 deletions plugin.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:amazon="http://schemas.android.com/apk/lib/com.amazon.device.ads" xmlns:rim="http://www.blackberry.com/ns/widgets" id="phonegap-plugin-push" version="2.0.0-rc2">
<?xml version="1.0" encoding="UTF-8"?>
<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:amazon="http://schemas.android.com/apk/lib/com.amazon.device.ads"
xmlns:rim="http://www.blackberry.com/ns/widgets"
id="phonegap-plugin-push"
version="2.0.0">

<name>PushPlugin</name>
<description>
This plugin allows your application to receive push notifications on Android, iOS and Windows devices.
Android uses Firebase Cloud Messaging.
iOS uses Apple APNS Notifications.
Windows uses Microsoft WNS Notifications.
</description>

<license>MIT</license>
<js-module src="www/push.js" name="PushNotification">
<clobbers target="PushNotification"/>
Expand Down Expand Up @@ -42,12 +49,17 @@
<action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
</intent-filter>
</service>
<!-- service android:name="com.adobe.phonegap.push.RegistrationIntentService" android:exported="false"/ -->
</config-file>
<framework src="com.android.support:support-v13:25.1.0"/>
<framework src="me.leolin:ShortcutBadger:1.1.11@aar"/>
<framework src="com.google.firebase:firebase-messaging:9.8.0"/>
<framework src="push.gradle" custom="true" type="gradleReference"/>
<source-file src="src/android/com/adobe/phonegap/push/FCMService.java" target-dir="src/com/adobe/phonegap/push/"/>
<framework src="com.android.support:support-v13:23+"/>
<framework src="com.google.firebase:firebase-messaging:9.0.0" />
<framework src="me.leolin:ShortcutBadger:1.1.14@aar"/>
<source-file src="src/android/com/adobe/phonegap/push/GCMIntentService.java" target-dir="src/com/adobe/phonegap/push/"/>
<source-file src="src/android/com/adobe/phonegap/push/PushConstants.java" target-dir="src/com/adobe/phonegap/push/"/>
<source-file src="src/android/com/adobe/phonegap/push/PushHandlerActivity.java" target-dir="src/com/adobe/phonegap/push/"/>
<source-file src="src/android/com/adobe/phonegap/push/PushInstanceIDListenerService.java" target-dir="src/com/adobe/phonegap/push/"/>
Expand Down Expand Up @@ -95,4 +107,4 @@
<preference name="WindowsToastCapable" value="true"/>
</config-file>
</platform>
</plugin>
</plugin>
5 changes: 4 additions & 1 deletion src/android/com/adobe/phonegap/push/PushPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,10 @@ private void subscribeToTopics(JSONArray topics, String registrationToken) {
String topic = null;
for (int i=0; i<topics.length(); i++) {
topic = topics.optString(i, null);
subscribeToTopic(topic, registrationToken);
if (topic != null) {
Log.d(LOG_TAG, "Subscribing to topic: " + topic);
FirebaseMessaging.getInstance().subscribeToTopic(topic);
}
}
}
}
Expand Down

0 comments on commit 1887154

Please sign in to comment.