Skip to content

Instantly share code, notes, and snippets.

@mitchtabian
Last active November 15, 2017 05:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mitchtabian/1159b148e2dd59c81ad7020ae833a5e1 to your computer and use it in GitHub Desktop.
Save mitchtabian/1159b148e2dd59c81ad7020ae833a5e1 to your computer and use it in GitHub Desktop.
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