| Class name | Class description |
| HuaweiApiAvailability | 用于校验设备上安装的HMS Core(APK)是否可用、是否需要升级。 |
| Type | Name | Desc |
| String | SERVICES_PACKAGE | HMS Core(APK)的包名。 |
| String | SERVICES_ACTION | HMS Core(APK)导出Service的Action。 |
| String | ACTIVITY_NAME | HMS Core(APK)导出Activity的类名。 |
| int | NOTICE_VERSION_CODE | client获取公告所需要的HMS Core(APK)的版本号。 |
| int | HMS_VERSION_MIN | 各业务要求的最低HMS Core(APK)的版本号。 |
| int | HMS_JSON_VERSION_MIN | JSON版本各业务要求的最低HMS Core(APK)的版本号。 |
| int | HMS_VERSION_MAX | CP所能配置的最高版本号。 |
| int | HMS_VERSION_CODE_MIN | CP所能配置的最低版本。 |
| String | HMS_API_NAME_ID | 帐号业务API名称。 |
| int | HMS_VERSION_CODE_ID | 帐号业务版本号。 |
| String | HMS_API_NAME_SNS | SNS业务API名称。 |
| int | HMS_VERSION_CODE_SNS | SNS业务版本号。 |
| String | HMS_API_NAME_PAY | 支付业务API名称。 |
| int | HMS_VERSION_CODE_PAY | 支付业务版本号。 |
| String | HMS_API_NAME_PUSH | PUSH业务API名称。 |
| int | HMS_VERSION_CODE_PUSH | PUSH业务版本号。 |
| String | HMS_API_NAME_GAME | 游戏业务API名称。 |
| int | HMS_VERSION_CODE_GAME | 游戏业务版本号。 |
| String | HMS_API_NAME_OD | 开发服务业务API名称。 |
| int | HMS_VERSION_CODE_OD | 开放服务业务版本号。 |
| String | HMS_API_NAME_IAP | IAP业务API名称。 |
| int | HMS_VERSION_CODE_IAP | IAP业务版本号。 |
| String | HMS_API_NAME_PPS | PPS业务API名称。 |
| int | HMS_VERSION_CODE_PPS | PPS业务版本号。 |
| int | HMS_SDK_VERSION_CODE | HMS SDK版本号。 |
| String | HMS_SDK_VERSION_NAME | HMS SDK版本名称。 |
| Return type | Method name |
| Map< String, Integer > | getApiMap() 获取各个业务的API对应的版本号信息。 |
| HuaweiApiAvailability | getInstance() 返回HuaweiApiAvailability的单实例。 |
| int | getServicesVersionCode() 返回业务版本号。 |
| void | setServicesVersionCode(int servicesVersionCode) 设置业务版本号。 |
| int | isHuaweiMobileServicesAvailable(Context context) 验证HMS Core(APK)在设备上是否成功安装和集成,检查已经安装的HMS Core(APK)版本号是否为client所需要的版本号或比需要的更新。该类为抽象方法,需要子类实现。 |
| int | isHuaweiMobileServicesAvailable(Context context, int minApkVersion) 验证HMS Core(APK)在设备上是否成功安装和集成,检查已经安装的HMS Core(APK)版本号是否为client所需要的版本号或比需要的更新。该类为抽象方法,需要子类实现。 |
| int | isHuaweiMobileNoticeAvailable(Context context) 验证HMS Core(APK)的版本是否支持获取公告,该类为抽象方法,需要子类实现。 |
| boolean | isUserResolvableError(int errorCode) 确定是否可以通过用户操作解决错误,该类为抽象方法,需要子类实现。 |
| void | resolveError(Activity activity, int errorCode, int requestCode) 如果可以通过用户操作解决错误,为返回的错误码显示一个通知/对话框,该类为抽象方法,需要子类实现。 |
| void | resolveError(Activity activity, int errorCode, int requestCode, PendingIntent pendingIntent) 如果可以通过用户操作解决错误,为返回的错误码显示一个通知/对话框,该类为抽象方法,需要子类实现。 |
| PendingIntent | getResolveErrorPendingIntent(Activity activity, int errorCode) 构建可解决方案的PendingIntent实例,该类为抽象方法,需要子类实现。 |
| Intent | getResolveErrorIntent(Activity activity, int errorCode) 构建可解决方案的PendingIntent实例,该类为抽象方法,需要子类实现。 |
| Dialog | getErrorDialog(Activity activity, int errorCode, int requestCode) 为isHuaweiMobileServicesAvailable(Context, int)方法返回的错误码显示一个通知/对话框。 |
| Dialog | getErrorDialog(Activity activity, int errorCode, int requestCode, DialogInterface.OnCancelListener onCancelListener) 为isHuaweiMobileServicesAvailable(Context, int)方法返回的错误码显示一个通知/对话框。 |
| String | getErrorString(int errorCode ) 为isHuaweiMobileServicesAvailable(Context, int)返回可读的文本形式的错误代码。 |
| boolean | showErrorDialogFragment (Activity activity, int errorCode, int requestCode) 根据错误码创建并展示对话框。 |
| boolean | showErrorDialogFragment (Activity activity, int errorCode, int requestCode, DialogInterface.OnCancelListener cancelListener) 根据错误码创建并展示对话框。 |
| void | showErrorNotification(Context context, int errorCode) 根据错误码创建错误Dialog并提示。 |
| Constant |
| public static final String SERVICES_PACKAGE |
| HMS Core(APK)的包名。 Constant Value: “com.huawei.hwid” |
| Constant |
| public static final String SERVICES_ACTION |
| HMS Core(APK)导出Service的Action。 Constant Value: “com.huawei.hms.core.aidlservice” |
| Constant |
| public static final String ACTIVITY_NAME |
| HMS Core(APK)导出Activity的类名。 Constant Value: “com.huawei.hms.core.activity.JumpActivity” |
| Constant |
| public static final int NOTICE_VERSION_CODE |
| client获取公告所需要的HMS Core(APK)的版本号。 Constant Value: “20600000” |
| Constant |
| public static final int HMS_VERSION_MIN |
| 各业务要求的最低HMS Core(APK)的版本号。 Constant Value: “20503000” |
| Constant |
| public static final int HMS_JSON_VERSION_MIN |
| JSON版本各业务要求的最低HMS Core(APK)的版本号。 Constant Value: “20701200” |
| Constant |
| public static final int HMS_VERSION_MAX |
| CP所能配置的最高版本号。 Constant Value: “20600000” |
| Constant |
| public static final int HMS_VERSION_CODE_MIN |
| CP所能配置的最低版本。 Constant Value: “20503000” |
| Constant |
| public static final String HMS_API_NAME_ID |
| 帐号业务API名称。 Constant Value: “HuaweiID.API” |
| Constant |
| public static final int HMS_VERSION_CODE_ID |
| 帐号业务版本号。 Constant Value: “20503000” |
| Constant |
| public static final String HMS_API_NAME_SNS |
| SNS业务API名称。 Constant Value: “HuaweiSns.API” |
| Constant |
| public static final int HMS_VERSION_CODE_SNS |
| SNS业务版本号。 Constant Value: “20503000” |
| Constant |
| Constant |
| public static final String HMS_API_NAME_PAY |
| 支付业务API名称。 Constant Value: “HuaweiPay.API” |
| Constant |
| public static final int HMS_VERSION_CODE_PAY |
| 支付业务版本号。 Constant Value: “20503000” |
| Constant |
| public static final String HMS_API_NAME_PUSH |
| PUSH业务API名称。 Constant Value: “HuaweiPush.API” |
| Constant |
| public static final int HMS_VERSION_CODE_PUSH |
| PUSH业务版本号。 Constant Value: “20503000” |
| Constant |
| public static final String HMS_API_NAME_GAME |
| 游戏业务API名称。 Constant Value: “HuaweiGame.API” |
| Constant |
| public static final int HMS_VERSION_CODE_GAME |
| 游戏业务版本号。 Constant Value: “20503000” |
| Constant |
| public static final String HMS_API_NAME_OD |
| 开发服务业务API名称。 Constant Value: “HuaweiOpenDevice.API” |
| Constant |
| public static final int HMS_VERSION_CODE_OD |
| 开放服务业务版本号。 Constant Value: “20601000” |
| Constant |
| public static final String HMS_API_NAME_IAP |
| IAP业务API名称。 Constant Value: “HuaweiIap.API” |
| Constant |
| public static final int HMS_VERSION_CODE_IAP |
| IAP业务版本号。 Constant Value: “20700300” |
| Constant |
| public static final String HMS_API_NAME_PPS |
| PPS业务API名称。 Constant Value: “HuaweiPPSkit.API” |
| Constant |
| public static final int HMS_VERSION_CODE_PPS |
| PPS业务版本号。 Constant Value: “20700300” |
| Constant |
| public static final int HMS_SDK_VERSION_CODE |
| HMS SDK版本号。 Constant Value: “30003300” |
| Constant |
| public static final String HMS_SDK_VERSION_NAME |
| HMS SDK版本名称。 Constant Value: “3.0.3.300” |
| Method |
public static < MapString, Integer > getApiMap() |
| 获取各个业务的API对应的版本号信息。 |
Return
| type | desc |
| Map< String, Integer > | 各个业务的API对应的版本号。 |
| Method |
public static HuaweiApiAvailability getInstance() |
| 返回 HuaweiApiAvailability 的单实例。 |
Return
| type | desc |
| HuaweiApiAvailability | HuaweiApiAvailability 的单实例。 |
| Method |
public static int getServicesVersionCode() |
| 返回业务版本号。 |
Return
| type | desc |
| int | 业务版本号。 |
| Method |
public static void setServicesVersionCode(int servicesVersionCode) |
| 设置业务版本号。 |
Parameters
| Parameter name | Parameter desc |
| servicesVersionCode | 业务版本号。 |
| Method |
public abstract int isHuaweiMobileServicesAvailable(Context context) |
| 验证HMS Core(APK)在设备上是否成功安装和集成,检查已经安装的HMS Core(APK)版本号是否为client所需要的版本号或比需要的更新。该类为抽象方法,需要子类实现。 |
Parameters
| Parameter name | Parameter desc |
| context | 上下文。 |
Return
| type | desc |
| int | 标识着是否有错误的状态码。 0: 存在可用的HMS Core(APK) 1: 在设备上没有发现HMS Core(APK) 2: 已经安装的HMS Core(APK)过时了3: 此设备上的HMS Core(APK)已经不可用 9: 设备上安装的HMS Core(APK)是假的 21: 设备太老,不支持HMS Core(APK)。 |
| Method |
public abstract int isHuaweiMobileServicesAvailable(Context context, int minApkVersion) |
| 验证HMS Core(APK)在设备上是否成功安装和集成,检查已经安装的HMS Core(APK)版本号是否为client所需要的版本号或比需要的更新。该类为抽象方法,需要子类实现。 |
Parameters
| Parameter name | Parameter desc |
| context | 上下文。 |
| minApkVersion | 业务要求的HMS最低版本号。 |
Return
| type | desc |
| int | 标识着是否有错误的状态码。 0: 存在可用的HMS Core(APK) 1: 在设备上没有发现HMS Core(APK) 2: 已经安装的HMS Core(APK)过时了3: 此设备上的HMS Core(APK)已经不可用 9: 设备上安装的HMS Core(APK)是假的 21: 设备太老,不支持HMS Core(APK)。 |
| Method |
public abstract int isHuaweiMobileNoticeAvailable(Context context) |
| 验证HMS Core(APK)的版本是否支持获取公告,该类为抽象方法,需要子类实现。 |
Parameters
| Parameter name | Parameter desc |
| context | 上下文。 |
Return
| type | desc |
| int | 标识着是否有错误的状态码。 0: HMS Core(APK)的版本支持获取公告 2: 已经安装的HMS Core(APK)过时了。 |
| Method |
public abstract boolean isUserResolvableError(int errorCode) |
| 确定是否可以通过用户操作解决错误,该类为抽象方法,需要子类实现。 |
Parameters
| Parameter name | Parameter desc |
| errorCode | 错误码。 |
Return
| type | desc |
| boolean | true:有解决方案 false:没有解决方案 |
| Method |
public abstract boolean isUserResolvableError(int errorCode, PendingIntent pendingIntent) |
| 确定是否可以通过用户操作解决错误,该类为抽象方法,需要子类实现。 |
Parameters
| Parameter name | Parameter desc |
| errorCode | 错误码。 |
| pendingIntent | 可以解决问题的pending Intent。 |
Return
| type | desc |
| boolean | true:有解决方案 false:没有解决方案 判断时如果pendingIntent不为空,则认为有解决方案,否则根据错误码errorCode来判断。 |
| Method |
public abstract void resolveError(Activity activity, int errorCode, int requestCode) |
| 如果可以通过用户操作解决错误,为返回的错误码显示一个通知/对话框,该类为抽象方法,需要子类实现。 |
Parameters
| Parameter name | Parameter desc |
| activity | 页面的activity。 |
| errorCode | 错误码,通过isUserResolvableError判断为true的错误码,系统支持通过用户操作解决错误。 |
| requestCode | 请求码,用于交互操作后,在activity的onActivityResult回到方法中使用。 |
| Method |
public abstract void resolveError(Activity activity, int errorCode, int requestCode, PendingIntent pendingIntent) |
| 如果可以通过用户操作解决错误,为返回的错误码显示一个通知/对话框,该类为抽象方法,需要子类实现。 |
Parameters
| Parameter name | Parameter desc |
| activity | 页面的activity。 |
| errorCode | 错误码,通过isUserResolvableError判断为true的错误码,系统支持通过用户操作解决错误。 |
| requestCode | 请求码,用于交互操作后,在activity的onActivityResult回到方法中使用。 |
| pendingIntent | 可以用于解决问题的pendingIntent,如果pendingIntent不为空,则优先使用 pendingIntent,否则使用errorCode匹配系统支持的解决方案。 |
| Method |
public abstract PendingIntent getResolveErrorPendingIntent(Activity activity, int errorCode) |
| 构建可解决方案的PendingIntent实例,该类为抽象方法,需要子类实现。 |
Parameters
| Parameter name | Parameter desc |
| activity | 页面的activity。 |
| errorCode | 错误码,通过isUserResolvableError判断为true的错误码,系统支持通过错码创建pendingIntent。 |
Return
| type | desc |
| PendingIntent | 可用于与用户交互操作解决问题的Intent。 |
| Method |
public abstract Intent getResolveErrorIntent(Activity activity, int errorCode) |
| 构建可解决方案的PendingIntent实例,该类为抽象方法,需要子类实现。 |
Parameters
| Parameter name | Parameter desc |
| activity | 页面的activity。 |
| errorCode | 错误码,通过isUserResolvableError判断为true的错误码,系统支持通过错码创建pendingIntent。 |
Return
| type | desc |
| Intent | 可用于与用户交互操作解决问题的Intent。 |
| Method |
public abstract Dialog getErrorDialog(Activity activity, int errorCode, int requestCode) |
| 为isHuaweiMobileServicesAvailable(Context, int)方法返回的错误码显示一个通知/对话框。 |
Parameters
| Parameter name | Parameter desc |
| activity | 页面的activity。 |
| errorCode | 错误码,通过isUserResolvableError判断为true的错误码,系统支持通过错码创建通知/对话框。 |
| requestCode | 请求码,用于透传。 |
Return
| type | desc |
| Dialog | 通知/对话框。 |
| Method |
abstract Dialog getErrorDialog(Activity activity, int errorCode, int requestCode, DialogInterface.OnCancelListener onCancelListener) |
| 为isHuaweiMobileServicesAvailable(Context, int)方法返回的错误码显示一个通知/对话框。 |
Parameters
| Parameter name | Parameter desc |
| activity | 页面的activity。 |
| errorCode | 错误码,通过isUserResolvableError判断为true的错误码,系统支持通过错码创建通知/对话框。 |
| requestCode | 请求码,用于透传。 |
| onCancelListener | 用户在对话框中点击取消时的处理。 |
Return
| type | desc |
| Dialog | 通知/对话框。 |
| Method |
public abstract String getErrorString(int errorCode ) |
| 为isHuaweiMobileServicesAvailable(Context, int)返回的错误代码的可读字符串。 |
Parameters
| Parameter name | Parameter desc |
| errorCode | 错误码。 |
Return
| type | desc |
| String | 错误码对应的描述信息。 |
| Method |
public abstract boolean showErrorDialogFragment (Activity activity, int errorCode, int requestCode) |
| 根据错误码创建并展示对话框。 |
Parameters
| Parameter name | Parameter desc |
| activity | 页面的activity。 |
| errorCode | 为isHuaweiMobileServicesAvailable(Context, int)方法返回的错误代码。 |
| requestCode | 请求码,用于透传。 |
Return
| type | desc |
| boolean | 如果显示对话框,则为true,否则为false。 |
| Method |
public abstract boolean showErrorDialogFragment (Activity activity, int errorCode, int requestCode, DialogInterface.OnCancelListener cancelListener) |
| 根据错误码创建并展示对话框。 |
Parameters
| Parameter name | Parameter desc |
| activity | 页面的activity。 |
| errorCode | 为isHuaweiMobileServicesAvailable(Context, int)方法返回的错误代码。 |
| requestCode | 请求码,用于透传。 |
| onCancelListener | 用户在对话框中点击取消时的处理。 |
Return
| type | desc |
| boolean | 如果显示对话框,则为true,否则为false。 |
| Method |
public abstract void showErrorNotification(Context context, int errorCode) |
| 根据错误码创建错误Dialog并提示。 |
Parameters
| Parameter name | Parameter desc |
| activity | 页面的activity。 |
| errorCode | 为isHuaweiMobileServicesAvailable(Context, int)方法返回的错误代码。 |