Answers for "device registration token firebase"

0

get device token firebase

//This is the only one worked for me as of August 29, 2021
FirebaseMessaging.getInstance().getToken().addOnSuccessListener(token -> {
        if (!TextUtils.isEmpty(token)) {
            Log.d(TAG, "token successfully retrieved : " + token);
        } else{
            Log.w(TAG, "token should not be null...");
        }
    }).addOnFailureListener(e -> {
        //handle e
    }).addOnCanceledListener(() -> {
        //handle cancel
    }).addOnCompleteListener(task -> Log.v(TAG, "This is the token : " + task.getResult()));
Posted by: Guest on August-28-2021
0

firebase registration token

FirebaseInstanceId.getInstance().getInstanceId().addOnSuccessListener(new OnSuccessListener<InstanceIdResult>() {
        @Override
        public void onSuccess(InstanceIdResult instanceIdResult) {
            String token = instanceIdResult.getToken();
            // send it to server
        }
    });
Posted by: Guest on February-23-2021

Code answers related to "device registration token firebase"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language