Category : token

private void updateToken(FirebaseUser firebaseUser) { DatabaseReference tokens = FirebaseDatabase.getInstance().getReference(Common.TOKENS); //Get Token FirebaseInstanceId.getInstance().getInstanceId().addOnSuccessListener(new OnSuccessListener<InstanceIdResult>() { @Override public void onSuccess(InstanceIdResult instanceIdResult) { tokens.child(firebaseUser.getUid()).setValue(instanceIdResult.getToken()); } }).addOnFailureListener(new OnFailureListener() { @Override public void onFailure(@NonNull Exception e) { Toast.makeText(MainActivity.this, ""+e.getMessage(), Toast.LENGTH_SHORT).show(); } }); } Source: Android Studio..

Read more

I’ve just implemented the new way of getting the Firebase token on Android and I am trying to fix my unit test accordingly, unfortunately without any success. Does anyone could help? The new way of getting the token based on the official doc looks like following: FirebaseMessaging.getInstance().token.addOnCompleteListener(OnCompleteListener { task -> if (!task.isSuccessful) { Log.w(TAG, "Fetching ..

Read more