In oreo 8.1.0 I cant get fcm device id

1.4k Views Asked by At

I am using vivo v9 android 8.1.0 oreo. i cant find device id

my config:

implementation 'com.google.firebase:firebase-messaging:17.3.0'
implementation 'com.google.firebase:firebase-core:16.0.3'

class path :

classpath 'com.google.gms:google-services:4.0.0'
2

There are 2 best solutions below

0
On BEST ANSWER

Manually we need to this dependencies
implementation 'com.google.android.gms:play-services:11.0.4'

And We need to create a Channel in FCM messaging class.

0
On

In Latest Firebase they change the method to get the Device Token.

Kindly follow the code where you want the ID

  FirebaseInstanceId.getInstance().getInstanceId().addOnSuccessListener(LoginPageActivity.this, new OnSuccessListener<InstanceIdResult>() {
 @Override
        public void onSuccess(InstanceIdResult instanceIdResult) {
            Log.e("Device Token",instanceIdResult.getToken());
        }
    });