FirebaseInstanceIdService is deprecated

后端 未结 10 2187

Hope all of you aware of this class, used to get notification token whenever firebase notification token got refreshed we get the refreshed token from this class, From follo

10条回答
  •  遇见更好的自我
    2020-11-22 10:21

    In KOTLIN:- If you want to save Token into DB or shared preferences then override onNewToken in FirebaseMessagingService

    override fun onNewToken(token: String) {
            super.onNewToken(token)
        }
    

    Get token at run-time,use

    FirebaseInstanceId.getInstance().instanceId
                            .addOnSuccessListener(this@SplashActivity) { instanceIdResult ->
                                val mToken = instanceIdResult.token
                                println("printing  fcm token: $mToken")
                            }
    

提交回复
热议问题