Assume I have a
You cannot block
FirebaseInstanceIdService.onTokenRefresh() from being called until the user is logged in.
What you could do in your use case is:
FirebaseInstanceIdService.onTokenRefresh()ignore the event if the user is not logged-in
onTokenRefresh()(or directly your logic) manually.
In this way you can process the token when the user is logged-in, and if the token is not available (or is rotated) you will receive the
onTokenRefresh() event later.