Skip to content

Instantly share code, notes, and snippets.

@mitchtabian mitchtabian/SendToken.java
Last active Nov 15, 2017

Embed
What would you like to do?
private void sendRegistrationToServer(String token) {
Log.d(TAG, "sendRegistrationToServer: sending token to server: " + token);
DatabaseReference reference = FirebaseDatabase.getInstance().getReference();
reference.child(getString(R.string.dbnode_users))
.child(FirebaseAuth.getInstance().getCurrentUser().getUid())
.child(getString(R.string.field_messaging_token))
.setValue(token);
}
private void initFCM(){
String token = FirebaseInstanceId.getInstance().getToken();
Log.d(TAG, "initFCM: token: " + token);
sendRegistrationToServer(token);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.