androidfirebasetokenhuawei-mobile-services

I can't get Firebase token from Huawei p40 series device


I usually get the token with this method, but with the arrival of the huawei p40 series I can't get the token with those

FirebaseInstanceId.getInstance().getInstanceId().addOnSuccessListener( this,  new OnSuccessListener<InstanceIdResult>() {
        @Override
        public void onSuccess(InstanceIdResult instanceIdResult) {
            final String token = instanceIdResult.getToken(); // i can't get this
        }
});

Solution

  • P40 contains Huawei Mobile Services. These devices don't have Google Mobile Services so Firebase won't work. There is alternative called Push Kit - https://developer.huawei.com/consumer/en/doc/development/HMS-Guides/push-introduction

    If you want to make it all working on a one platform, you can try:

    They are working with Google and Huawei.