Error getting Firebase InstanceID in Android Studio

0

I'm trying to get the instanceId of firebase in Android Studio, but an error occurs in my Debug console.

E / FirebaseInstanceId: Google Play services missing or without correct permission.

My MyFirebaseMessagingService class is like this.

const val TAG="MyFirebase"

class MyFirebaseMessagingService: FirebaseMessagingService () {     override fun onMessageReceived (remoteMessage: RemoteMessage?) {

    if(remoteMessage?.data != null){
        Log.d(TAG, "Data : " + remoteMessage.data.toString())
    }

    if(remoteMessage?.data != null){
        Log.d(TAG, "Notificação : " + remoteMessage.notification!!.toString())
    }
}

override fun onNewToken(token: String?) {
    val tokenAtualizado = FirebaseInstanceId.getInstance().id
    Log.d(TAG,"Token atualizado: " + tokenAtualizado)
}

}

    
asked by anonymous 03.10.2018 / 03:04

0 answers