gpt4 book ai didi

android - 如何检查 Google Play 服务是否已从 android 中的代码启用/禁用

转载 作者:行者123 更新时间:2023-11-29 17:32:30 25 4
gpt4 key购买 nike

我需要检查手机是否启用/禁用/可用/未安装播放服务。

我使用下面的代码

final int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
if (status != ConnectionResult.SUCCESS) {
Log.e(TAG, GooglePlayServicesUtil.getErrorString(status));
return false;
} else {
Log.i(TAG, GooglePlayServicesUtil.getErrorString(status));
return true;
}

即使播放服务处于禁用状态,也会返回“2”。如何克服这个.?

最佳答案

你的方法很好。状态“2”表示 Google Play 服务可用但需要更新。检查 ConnectionResult 类的所有可能状态:

public static final int SUCCESS = 0;
public static final int SERVICE_MISSING = 1;
public static final int SERVICE_VERSION_UPDATE_REQUIRED = 2;
public static final int SERVICE_DISABLED = 3;
public static final int SIGN_IN_REQUIRED = 4;
public static final int INVALID_ACCOUNT = 5;
public static final int RESOLUTION_REQUIRED = 6;
public static final int NETWORK_ERROR = 7;
public static final int INTERNAL_ERROR = 8;
public static final int SERVICE_INVALID = 9;
public static final int DEVELOPER_ERROR = 10;
public static final int LICENSE_CHECK_FAILED = 11;
public static final int CANCELED = 13;
public static final int TIMEOUT = 14;
public static final int INTERRUPTED = 15;
public static final int API_UNAVAILABLE = 16;
public static final int SIGN_IN_FAILED = 17;

关于android - 如何检查 Google Play 服务是否已从 android 中的代码启用/禁用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32220798/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com