summaryrefslogtreecommitdiff
path: root/StoneIsland/plugins/cordova-plugin-firebase/src/android/FirebasePluginInstanceIDService.java
diff options
context:
space:
mode:
Diffstat (limited to 'StoneIsland/plugins/cordova-plugin-firebase/src/android/FirebasePluginInstanceIDService.java')
-rwxr-xr-xStoneIsland/plugins/cordova-plugin-firebase/src/android/FirebasePluginInstanceIDService.java26
1 files changed, 26 insertions, 0 deletions
diff --git a/StoneIsland/plugins/cordova-plugin-firebase/src/android/FirebasePluginInstanceIDService.java b/StoneIsland/plugins/cordova-plugin-firebase/src/android/FirebasePluginInstanceIDService.java
new file mode 100755
index 00000000..96140f02
--- /dev/null
+++ b/StoneIsland/plugins/cordova-plugin-firebase/src/android/FirebasePluginInstanceIDService.java
@@ -0,0 +1,26 @@
+package org.apache.cordova.firebase;
+
+import android.util.Log;
+
+import com.google.firebase.iid.FirebaseInstanceId;
+import com.google.firebase.iid.FirebaseInstanceIdService;
+
+
+public class FirebasePluginInstanceIDService extends FirebaseInstanceIdService {
+
+ private static final String TAG = "FirebasePlugin";
+
+ /**
+ * Called if InstanceID token is updated. This may occur if the security of
+ * the previous token had been compromised. Note that this is called when the InstanceID token
+ * is initially generated so this is where you would retrieve the token.
+ */
+ @Override
+ public void onTokenRefresh() {
+ // Get updated InstanceID token.
+ String refreshedToken = FirebaseInstanceId.getInstance().getToken();
+ Log.d(TAG, "Refreshed token: " + refreshedToken);
+
+ FirebasePlugin.sendToken(refreshedToken);
+ }
+}