Skip to content


Sending Push Notifications Using Firebase Functions
Browse files Browse the repository at this point in the history
  • Loading branch information
dragosholban committed May 13, 2018
1 parent 7241106 commit 72598ab
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 0 deletions.
Binary file modified .idea/caches/build_file_checksums.ser
Binary file not shown.
1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ dependencies {
implementation ''
implementation ''
implementation 'com.squareup.picasso:picasso:2.71828'
implementation ''

apply plugin: ''
6 changes: 6 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@
<action android:name=""/>

Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package com.dragosholban.myinstagramapp;


public class MyFirebaseInstanceIDService extends FirebaseInstanceIdService {

* 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.
// [START refresh_token]
public void onTokenRefresh() {
// Get updated InstanceID token.
String refreshedToken = FirebaseInstanceId.getInstance().getToken();

// If you want to send messages to this application instance or
// manage this apps subscriptions on the server side, send the
// Instance ID token to your app server.
// [END refresh_token]

* Persist token to third-party servers.
* Modify this method to associate the user's FCM InstanceID token with any server-side account
* maintained by your application.
* @param token The new token.
private void sendRegistrationToServer(String token) {
FirebaseUser firebaseUser = FirebaseAuth.getInstance().getCurrentUser();
if (firebaseUser != null) {
User user = new User(firebaseUser.getUid(), firebaseUser.getDisplayName(), token);
DatabaseReference database = FirebaseDatabase.getInstance().getReference();

0 comments on commit 72598ab

Please sign in to comment.