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 24, 2017
1 parent e3c63a9 commit 271ee0f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,4 @@
<preference name="WindowsToastCapable" value="true"/>
</config-file>
</platform>
</plugin>
</plugin>
9 changes: 8 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 All @@ -364,6 +367,10 @@ private void unsubscribeFromTopics(JSONArray topics, String registrationToken) {
for (int i=0; i<topics.length(); i++) {
topic = topics.optString(i, null);
unsubscribeFromTopic(topic, registrationToken);
if (topic != null) {
Log.d(LOG_TAG, "Unsubscribing to topic: " + topic);
FirebaseMessaging.getInstance().unsubscribeFromTopic(topic);
}
}
}
}
Expand Down

0 comments on commit 271ee0f

Please sign in to comment.