3

How I can detect that HMS services are available for some phone?

The question is a duplicate of answer but let it be cause googling with check huawei services is available didn't provide me with a link for StackOverflow question (Have both GMS and HMS in the project). Let Google indexing this for better search possibilities.

ahuminskyi
  • 211
  • 2
  • 8

2 Answers2

5

First of all you should read this answer. The answer contains the link to the old documentation version of HMS. Here is the new one - link. Find the isHuaweiMobileServicesAvailable method and read about return constants description.

Best wishes!

ahuminskyi
  • 211
  • 2
  • 8
4

You can use this method to detect

public static boolean isHmsAvailable(Context context) {
        boolean isAvailable = false;
        if (null != context) {
            int result = HuaweiApiAvailability.getInstance().isHuaweiMobileServicesAvailable(context);
            isAvailable = (com.huawei.hms.api.ConnectionResult.SUCCESS == result);
        }
        Log.i(TAG, "isHmsAvailable: " + isAvailable);
        return isAvailable;
    }
AzharAli
  • 41
  • 1