此方法不断返回 0。根据开发人员文档,如果设备安装了最新版本的 google play,此方法应返回类似 SUCCES 的内容。有人知道如何使用这个吗?
@Override
public void onResume() {
super.onResume();
GooglePlayServicesUtil.isGooglePlayServicesAvailable(getApplicationContext());
System.out.println("henkie: " + GooglePlayServicesUtil.isGooglePlayServicesAvailable(getApplicationContext()));
}
它正在回归SUCCESS
. The 文档 http://developer.android.com/reference/com/google/android/gms/common/GooglePlayServicesUtil.html#isGooglePlayServicesAvailable%28android.content.Context%29明确指出该方法有一个 int 返回类型,并返回一个
状态码指示是否有错误。可以是其中之一
ConnectionResult 中包含以下内容:SUCCESS、SERVICE_MISSING、
SERVICE_VERSION_UPDATE_REQUIRED、SERVICE_DISABLED、SERVICE_INVALID。
要检查返回的内容,请使用以下内容:
int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getApplicationContext());
if(status == ConnectionResult.SUCCESS) {
//Success! Do what you want
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)