get device token firebase

Solutions on MaxInterview for get device token firebase by the best coders in the world

showing results for - "get device token firebase"
Karl
12 Sep 2016
1//This is the only one worked for me as of August 29, 2021
2FirebaseMessaging.getInstance().getToken().addOnSuccessListener(token -> {
3        if (!TextUtils.isEmpty(token)) {
4            Log.d(TAG, "token successfully retrieved : " + token);
5        } else{
6            Log.w(TAG, "token should not be null...");
7        }
8    }).addOnFailureListener(e -> {
9        //handle e
10    }).addOnCanceledListener(() -> {
11        //handle cancel
12    }).addOnCompleteListener(task -> Log.v(TAG, "This is the token : " + task.getResult()));