private String FCMGetFreshToken ( final String senderID ) { String token = null ; try { if ( senderID != null ) { getConfigLogger ( ) . verbose ( getAccountId ( ) , "FcmManager: Requesting a FCM token with Sender Id - " + senderID ) ; token = FirebaseInstanceId . getInstance ( ) . getToken ( senderID , FirebaseMessaging . INSTANCE_ID_SCOPE ) ; } else { getConfigLogger ( ) . verbose ( getAccountId ( ) , "FcmManager: Requesting a FCM token" ) ; token = FirebaseInstanceId . getInstance ( ) . getToken ( ) ; } getConfigLogger ( ) . info ( getAccountId ( ) , "FCM token: " + token ) ; } catch ( Throwable t ) { getConfigLogger ( ) . verbose ( getAccountId ( ) , "FcmManager: Error requesting FCM token" , t ) ; } return token ; }
request token from FCM