Reputation: 228
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
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
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