Every time the device token is changed , It is reflected in onTokenRefresh() method. For getting the device token when it is changed, we can call this method to get the refreshed token. and to get the device token at any time we can use FirebaseInstanceId. getInstance().