Created
June 30, 2016 03:49
-
-
Save griajobag/7e7c03db19cc739801ed17edc341a6b3 to your computer and use it in GitHub Desktop.
firebase notif
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.putuguna.firebasenotif.firebases; | |
import android.util.Log; | |
import com.google.firebase.iid.FirebaseInstanceId; | |
import com.google.firebase.iid.FirebaseInstanceIdService; | |
/** | |
* Created by putuguna on 20/06/16. | |
*/ | |
public class MyFirebaseInstanceIDService extends FirebaseInstanceIdService { | |
private static final String TAG = "MyFirebaseInstanceIDService"; | |
@Override | |
public void onTokenRefresh() { | |
//super.onTokenRefresh(); | |
//getting registration token | |
String refreshToken = FirebaseInstanceId.getInstance().getToken(); | |
//Displaying token in Logcat | |
Log.d("TAG", "Refreshed Token : " + refreshToken); | |
sendRegistrationToServer(refreshToken); | |
} | |
private void sendRegistrationToServer(String token) { | |
//You can implement this method to store the token on your server | |
//Not required for current project | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment