如何检查是否在设备中启用了Google移动服务?
问题描述:
我必须检查Google服务是否在设备上处于活动状态.我该如何检查?看起来只玩服务就足够了吗?
I have to check if google services are active on the device. How can I check it? Looking just play services is enough?
我需要这张支票以获取华为服务.
I need this check for Huawei services.
答
您可以使用以下代码进行检查:
You can use these codes to check:
boolean flag = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(this) == com.google.android.gms.common.ConnectionResult.SUCCESS
如果 flag == true
,则在设备中启用GMS.
If flag == true
, then GMS is enable in device.
如果 flag == false
,则在设备中禁用了GMS.
If flag == false
, then GMS is disable in device.