I am using the below-mentioned code to fetch the FCM registration token, but when I reinstall the app the token doesn't generate and giving the error java.util.concurrent.ExecutionException: java.io.IOException: SERVICE_NOT_AVAILABLE
Please help.
FirebaseMessaging.getInstance().getToken()
.addOnCompleteListener(new OnCompleteListener<String>() {
@Override
public void onComplete(@NonNull Task<String> task) {
if (!task.isSuccessful()) {
Log.w("TAG", "Fetching FCM token failed", task.getException());
return;
}
fcmToken = task.getResult();
}
});