forked from fullstackreact/react-native-firestack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFirestackInstanceIdService.java
More file actions
33 lines (26 loc) · 865 Bytes
/
Copy pathFirestackInstanceIdService.java
File metadata and controls
33 lines (26 loc) · 865 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package io.fullstack.firestack;
/**
* Created by nori on 2016/09/12.
*/
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import com.google.firebase.iid.FirebaseInstanceId;
import com.google.firebase.iid.FirebaseInstanceIdService;
public class FirestackInstanceIdService extends FirebaseInstanceIdService {
private static final String TAG = "FSInstanceIdService";
/**
*
*/
@Override
public void onTokenRefresh() {
String refreshedToken = FirebaseInstanceId.getInstance().getToken();
Log.d(TAG, "Refreshed token: " + refreshedToken);
// send Intent
Intent i = new Intent(FirestackCloudMessaging.INTENT_NAME_TOKEN);
Bundle bundle = new Bundle();
bundle.putString("token", refreshedToken);
i.putExtras(bundle);
sendBroadcast(i);
}
}