我如何确保我的应用支持最低 Google Play Services 4.1 版本?
How can i ensure that my app support minimum Google Play Services 4.1 version?
我在检查 Google Play 服务可用性时需要获取 ConnectionResult.SUCCESS 如果已安装 Google Play 服务版本为 4.1+:
int code = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
目前我正在获取代码 == ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED,
当 Google Play 服务版本为 5.0.84 时。
我知道我只需要添加一些标签到清单 应该包括 GooglePlayServices 版本代码。但是我不知道 一个和 4.1 是什么版本号。
请指教
这是我到目前为止发现的:
无需对清单文件进行任何更改。
Google Play 服务的版本代码是 7 位数字,其复杂性与版本名称相同。
例如:
版本 4.1.00 的代码为 4100000
版本 6.5.99 的代码为 6599000
因此,当我需要检查是否已安装 GooglePlayServices 是否已足够更新时,我会这样做:
int code = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
...
if (code == ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED) {
if (GooglePlayServicesUtil.GOOGLE_PLAY_SERVICES_VERSION_CODE >= 4100000)
result = true;// Meets minimum version requirements
}
如果您需要支持 GMS 回到 4.1,您需要包含以下依赖项
compile 'com.google.android.gms:play-services:4.1.32'
或者,如果您使用的是 Eclipse,则提取 <android-sdk>\extras\google\m2repository\com\google\android\gms\play-services.1.32\play-services-4.1.32.aar
并将其作为库项目导入。
这会将4.1.32 版的GMS 接口库添加到您的项目中。这也意味着您必须使用较旧的 API(在统一 GoogleApiClient
之前)。
我在检查 Google Play 服务可用性时需要获取 ConnectionResult.SUCCESS 如果已安装 Google Play 服务版本为 4.1+:
int code = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
目前我正在获取代码 == ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED, 当 Google Play 服务版本为 5.0.84 时。
我知道我只需要添加一些标签到清单 应该包括 GooglePlayServices 版本代码。但是我不知道 一个和 4.1 是什么版本号。 请指教
这是我到目前为止发现的:
无需对清单文件进行任何更改。
Google Play 服务的版本代码是 7 位数字,其复杂性与版本名称相同。
例如:
版本 4.1.00 的代码为 4100000 版本 6.5.99 的代码为 6599000
因此,当我需要检查是否已安装 GooglePlayServices 是否已足够更新时,我会这样做:
int code = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
...
if (code == ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED) {
if (GooglePlayServicesUtil.GOOGLE_PLAY_SERVICES_VERSION_CODE >= 4100000)
result = true;// Meets minimum version requirements
}
如果您需要支持 GMS 回到 4.1,您需要包含以下依赖项
compile 'com.google.android.gms:play-services:4.1.32'
或者,如果您使用的是 Eclipse,则提取 <android-sdk>\extras\google\m2repository\com\google\android\gms\play-services.1.32\play-services-4.1.32.aar
并将其作为库项目导入。
这会将4.1.32 版的GMS 接口库添加到您的项目中。这也意味着您必须使用较旧的 API(在统一 GoogleApiClient
之前)。