No Google services available in this device

Viewed 578

I am trying to integrate HMS kits i.e. location, ads, etc. into my app so that I can launch app into appGallery as well. However, I also use react-native-firebase for other services. Now, I get alert/dialog saying: "No google services available in this device...."´

How to fix this issue? Is there any way to avoid this message?

2 Answers

That's true that GMS is not supported on Huawei phones released after the Google ban. However, if you just want to suppress this dialog complaining "No google services available in this device...." in RN that could be achieved by Turning off Google Play Services availability errors:

firebase.utils().errorOnMissingPlayServices = false;
firebase.utils().promptOnMissingPlayServices = false;

for more information please visit this link.

GMS is not supported on Huawei phones released after the Google ban. Here I provide two options for you:

Option 1: Release your app both on HUAWEI AppGallery and Google Play, with different packages. The app you release on AppGallery contains only Huawei's logic code. For details about multi-channel packaging, please refer to docs.

Option 2: Release the same app on HUAWEI AppGallery and Google Play. Add the following code to determine whether GMS APIs or HMS APIs are available and call the available APIs:

public boolean  isGMS(){
    return GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(this) == com.google.android.gms.common.ConnectionResult.SUCCESS;
}
public boolean  isHMS(){
    return HuaweiApiAvailability.getInstance().isHuaweiMobileServicesAvailable(this) == com.huawei.hms.api.ConnectionResult.SUCCESS;
}

You can add the code manually, or use HMS ToolKit to realize G+H logic judgment.

Related