Android GooglePlayServicesUtil.getOpenSourceSoftwareLicenseInfo(this) 在谷歌播放服务版本 9.0.83 上返回 null

标签 android google-play-services android-sdk-2.3

我遇到了 GooglePlayServiceUtil 的问题,一些设备安装了 9.0.83 的 google play 服务。 我在具有播放服务版本 8.7.03 的设备中检查了相同的内容,并且我收到了法律声明。

下面是我用来获取法律声明的代码。

TextView tv = (TextView) findViewById(R.id.notice);
if (GooglePlayServicesUtil.isGooglePlayServicesAvailable(this) == ConnectionResult.SUCCESS) {
        Toast.makeText(this, "ConnectionResult.SUCCESS", Toast.LENGTH_LONG).show();
        tv.setText(GooglePlayServicesUtil.getOpenSourceSoftwareLicenseInfo(this));
}else if(GooglePlayServicesUtil.isGooglePlayServicesAvailable(this) == ConnectionResult.SERVICE_MISSING){
        Toast.makeText(this, "ConnectionResult.SERVICE_MISSING", Toast.LENGTH_LONG).show();
}else if(GooglePlayServicesUtil.isGooglePlayServicesAvailable(this) == ConnectionResult.SERVICE_DISABLED){
        Toast.makeText(this, "ConnectionResult.SERVICE_DISABLED", Toast.LENGTH_LONG).show();
}

GooglePlayServicesUtil.getOpenSourceSoftwareLicenseInfo(this) 

为版本 9.0.83 返回 null。但它返回版本 8.7.03 和 7.x.x 设备的法律声明字符串。

我也试过

GoogleApiAvailability.getInstance().getOpenSourceSoftwareLicenseInfo(Context)

但结果与 GooglePlayServicesUtil 相同。 如果有人可以指导我获得正确的结果,那将会很有帮助。

最佳答案

我遇到了同样的问题,在升级 Google Play 服务(撰写此答案时为 9.0.0)、重建项目并重新安装应用程序后,我开始正确获取许可证。

我正在使用 GoogleApiAvailability.getInstance().getOpenSourceSoftwareLicenseInfo(this);

关于Android GooglePlayServicesUtil.getOpenSourceSoftwareLicenseInfo(this) 在谷歌播放服务版本 9.0.83 上返回 null,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37347451/

相关文章:

android - 如何管理不同设计的代码以支持所有设备

android - Google Activity Recognition 是否适用于旧版 Android?

android - 无法在 Debug模式下登录 Google Play 服务

android - 回合制游戏玩家无需对手调用 takeTurn 即可接收自己的数据

android - 在 Android 中手动创建 UI 线程以增加其小堆栈大小

android - 如何从 Logcat 隐藏 NativeCrypto 消息

android - Google Places API Android resultCallback 未触发

android - 如何在 Android 手机启动时打开我的 Android 应用程序?

Android DatePickerDialog - 因 IllegalArgumentException 而失败

java - Listview onClick更改图像中的Android Imageview无法正常工作