If you are still using old style to get FireBase token, it is time to change it.

Old way

String token = FirebaseInstanceId.getInstance().getToken();

New way

				.addOnCompleteListener(new OnCompleteListener<InstanceIdResult>() {
					public void onComplete(@NonNull Task<InstanceIdResult> task) {
						if (!task.isSuccessful()) {
							Log.w("FB token e: ", "getInstanceId failed", task.getException());

						// Get new Instance ID token
						String token = task.getResult().getToken();
						Log.d("FB token", token);
						if (!token.equals("")) {
// send to your server						}
Spread the love

Leave a comment