ahuminskyi
ahuminskyi

Reputation: 228

Check the Huawei Mobile Services (HMS) availability

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.

Upvotes: 3

Views: 2935

Answers (2)

AzharAli
AzharAli

Reputation: 51

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;
    }

Upvotes: 5

ahuminskyi
ahuminskyi

Reputation: 228

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!

Upvotes: 5

Related Questions