| Class name | Class description |
| HuaweiApiAvailability | Verifies whether the HMS Core (APK) installed on the device is available and needs to be upgraded. |
| Type | Name | Desc |
| String | SERVICES_PACKAGE | Package name of HMS Core (APK). |
| String | SERVICES_ACTION | Action of the service exported by HMS Core(APK). |
| String | ACTIVITY_NAME | Category of the activity exported from HMS Core (APK). |
| int | NOTICE_VERSION_CODE | Version number of HMS Core (APK) required by the client to obtain notifications. |
| int | HMS_VERSION_MIN | Earliest HMS Core (APK) version required by each service. |
| int | HMS_JSON_VERSION_MIN | Earliest HMS Core (APK) version required by each service of the JSON version. |
| int | HMS_VERSION_MAX | Latest version that can be configured for a CP. |
| int | HMS_VERSION_CODE_MIN | Earliest version that can be configured for a CP. |
| String | HMS_API_NAME_ID | API name of the HUAWEI ID service. |
| int | HMS_VERSION_CODE_ID | Version number of the HUAWEI ID service. |
| String | HMS_API_NAME_SNS | API name of the SNS service. |
| int | HMS_VERSION_CODE_SNS | Version number of the SNS service. |
| String | HMS_API_NAME_PAY | API name of the HUAWEI Pay service. |
| int | HMS_VERSION_CODE_PAY | Version number of the HUAWEI Pay service. |
| String | HMS_API_NAME_PUSH | API name of the HUAWEI Push service. |
| int | HMS_VERSION_CODE_PUSH | Version number of the HUAWEI Push service. |
| String | HMS_API_NAME_GAME | API name of the HUAWEI Game service. |
| int | HMS_VERSION_CODE_GAME | Version number of the HUAWEI Game service. |
| String | HMS_API_NAME_OD | API name of the service. |
| int | HMS_VERSION_CODE_OD | Version number of the service. |
| String | HMS_API_NAME_IAP | API name of the HUAWEI IAP service. |
| int | HMS_VERSION_CODE_IAP | Version number of the HUAWEI IAP service. |
| String | HMS_API_NAME_PPS | API name of the HUAWEI PPS service. |
| int | HMS_VERSION_CODE_PPS | Version number of the HUAWEI PPS service. |
| int | HMS_SDK_VERSION_CODE | Version number of the HMS SDK. |
| String | HMS_SDK_VERSION_NAME | Version name of the HMS SDK. |
| Return type | Method name |
| Map< String, Integer > | getApiMap() Obtains the API version number of each service. |
| HuaweiApiAvailability | getInstance() Returns the singleton instance of HuaweiApiAvailability. |
| int | getServicesVersionCode() Returns the service version number. |
| void | setServicesVersionCode(int servicesVersionCode) Sets the service version number. |
| int | isHuaweiMobileServicesAvailable(Context context) Checks whether the HMS Core (APK) is successfully installed and integrated on the device, and whether the version of the installed HMS APK is the version required by the client or is later than the required version. |
| int | isHuaweiMobileServicesAvailable(Context context, int minApkVersion) Checks whether the HMS Core (APK) is successfully installed and integrated on the device, and whether the version of the installed HMS Core (APK) is the version required by the client or is later than the required version. |
| int | isHuaweiMobileNoticeAvailable(Context context) Checks whether the HMS Core (APK) version supports notification receipt. |
| boolean | isUserResolvableError(int errorCode) Determines whether a failure can be resolved via user action. |
| void | resolveError(Activity activity, int errorCode, int requestCode) If an issue can be resolved through user operations, a notification or dialog box is displayed for the returned error code. |
| void | resolveError(Activity activity, int errorCode, int requestCode, PendingIntent pendingIntent) If an issue can be resolved through user operations, a notification or dialog box is displayed for the returned error code. |
| PendingIntent | getResolveErrorPendingIntent(Activity activity, int errorCode) Constructs a pending intent that can resolve the issue. |
| Intent | getResolveErrorIntent(Activity activity, int errorCode) Constructs a pending intent that can resolve the issue. |
| Dialog | getErrorDialog(Activity activity, int errorCode, int requestCode) Displays a notification/dialog box for the error code returned by the isHuaweiMobileServicesAvailable(Context, int) method. |
| Dialog | getErrorDialog(Activity activity, int errorCode, int requestCode, DialogInterface.OnCancelListener onCancelListener) Displays a notification/dialog box for the error code returned by the isHuaweiMobileServicesAvailable(Context, int) method. |
| String | getErrorString(int errorCode ) human-readable string of the error code returned from isHuaweiMobileServicesAvailable(Context, int). |
| boolean | showErrorDialogFragment (Activity activity, int errorCode, int requestCode) Creates and displays a dialog box for an error code. |
| boolean | showErrorDialogFragment (Activity activity, int errorCode, int requestCode, DialogInterface.OnCancelListener cancelListener) Creates and displays a dialog box for an error code. |
| void | showErrorNotification(Context context, int errorCode) Creates and displays a dialog for an error code. |
| Constant |
| public static final String SERVICES_PACKAGE |
| Package name of HMS Core (APK). Constant Value: “com.huawei.hwid” |
| Constant |
| public static final String SERVICES_ACTION |
| Action of the service exported by HMS Core (APK). Constant Value: “com.huawei.hms.core.aidlservice” |
| Constant |
| public static final String ACTIVITY_NAME |
| Category of the activity exported from HMS Core (APK). Constant Value: “com.huawei.hms.core.activity.JumpActivity” |
| Constant |
| public static final int NOTICE_VERSION_CODE |
| Version number of HMS Core (APK) required by the client to obtain notifications. Constant Value: “20600000” |
| Constant |
| public static final int HMS_VERSION_MIN |
| Earliest HMS Core (APK) version required by each service. Constant Value: “20503000” |
| Constant |
| public static final int HMS_JSON_VERSION_MIN |
| Earliest HMS Core (APK) version required by each service of the JSON version. Constant Value: “20701200” |
| Constant |
| public static final int HMS_VERSION_MAX |
| Latest version that can be configured for a CP. Constant Value: “20600000” |
| Constant |
| public static final int HMS_VERSION_CODE_MIN |
| Earliest version that can be configured for a CP. Constant Value: “20503000” |
| Constant |
| public static final String HMS_API_NAME_ID |
| API name of the HUAWEI ID service. Constant Value: “HuaweiID.API” |
| Constant |
| public static final int HMS_VERSION_CODE_ID |
| Version number of the HUAWEI ID service. Constant Value: “20503000” |
| Constant |
| public static final String HMS_API_NAME_SNS |
| API name of the SNS service. Constant Value: “HuaweiSns.API” |
| Constant |
| public static final int HMS_VERSION_CODE_SNS |
| Version number of the SNS service. Constant Value: “20503000” |
| Constant |
| public static final String HMS_API_NAME_PAY |
| API name of the HUAWEI Pay service. Constant Value: “HuaweiPay.API” |
| Constant |
| public static final int HMS_VERSION_CODE_PAY |
| Version number of the HUAWEI Pay service. Constant Value: “20503000” |
| Constant |
| public static final String HMS_API_NAME_PUSH |
| API name of the HUAWEI Push service. Constant Value: “HuaweiPush.API” |
| Constant |
| public static final int HMS_VERSION_CODE_PUSH |
| Version number of the HUAWEI Push service. Constant Value: “20503000” |
| Constant |
| public static final String HMS_API_NAME_GAME |
| API name of the HUAWEI Game service. Constant Value: “HuaweiGame.API” |
| Constant |
| public static final int HMS_VERSION_CODE_GAME |
| Version number of the HUAWEI Game service. Constant Value: “20503000” |
| Constant |
| public static final String HMS_API_NAME_OD |
| API name of the service. Constant Value: “HuaweiOpenDevice.API” |
| Constant |
| public static final int HMS_VERSION_CODE_OD |
| Version number of the service. Constant Value: “20601000” |
| Constant |
| public static final String HMS_API_NAME_IAP |
| API name of the HUAWEI IAP service. Constant Value: “HuaweiIap.API” |
| Constant |
| public static final int HMS_VERSION_CODE_IAP |
| Version number of the HUAWEI IAP service. Constant Value: “20700300” |
| Constant |
| public static final String HMS_API_NAME_PPS |
| API name of the HUAWEI PPS service. Constant Value: “HuaweiPPSkit.API” |
| Constant |
| public static final int HMS_VERSION_CODE_PPS |
| Version number of the HUAWEI PPS service. Constant Value: “20700300” |
| Constant |
| public static final int HMS_SDK_VERSION_CODE |
| Version number of the HMS SDK. Constant Value: “30003300” |
| Constant |
| public static final String HMS_SDK_VERSION_NAME |
| Version name of the HMS SDK. Constant Value: “3.0.3.300” |
| Method |
public static < MapString, Integer > getApiMap() |
| Obtains the API version number of each service. |
Return
| type | desc |
| Map< String, Integer > | Version number of the API of each service. |
| Method |
public static HuaweiApiAvailability getInstance() |
| Returns the singleton instance of HuaweiApiAvailability. |
Return
| type | desc |
| HuaweiApiAvailability | Singleton instance of HuaweiApiAvailability. |
| Method |
public static int getServicesVersionCode() |
| Returns the service version number. |
Return
| type | desc |
| int | Service version number. |
| Method |
public static void setServicesVersionCode(int servicesVersionCode) |
| Sets the service version number. |
Parameters
| Parameter name | Parameter desc |
| servicesVersionCode | Service version number. |
| Method |
public abstract int isHuaweiMobileServicesAvailable(Context context) |
| Checks whether the HMS Core (APK) is successfully installed and integrated on the device, and whether the version of the installed HMS Core (APK) is the version required by the client or is later than the required version. |
Parameters
| Parameter name | Parameter desc |
| context | Context. |
Return
| type | desc |
| int | Status code indicating whether there is an error. 0: connection succeeded. 1: no HMS Core (APK) found on the device. 2: The installed HMS Core (APK) is out of date. 3: The HMS Core (APK) installed on this device is unavailable. 9: The HMS Core (APK) installed on the device is not the official version. 21: The device is too old to be supported. |
| Method |
public abstract int isHuaweiMobileServicesAvailable(Context context, int minApkVersion) |
| Checks whether the HMS Core (APK) is successfully installed and integrated on the device, and whether the version of the installed HMS Core (APK) is the version required by the client or is later than the required version. |
Parameters
| Parameter name | Parameter desc |
| context | Context. |
| minApkVersion | Earliest version number of the HMS required by the service. |
Return
| type | desc |
| int | Status code indicating whether there is an error. 0: connection succeeded. 1: no HMS Core (APK) found on the device. 2: The installed HMS Core (APK) is out of date. 3: The HMS Core (APK)installed on this device is unavailable. 9: The HMS Core (APK)installed on the device is not the official version. 21: The device is too old to be supported. |
| Method |
public abstract int isHuaweiMobileNoticeAvailable(Context context) |
| Checks whether the HMS Core (APK) version supports notification receipt. |
Parameters
| Parameter name | Parameter desc |
| context | Context. |
Return
| type | desc |
| int | Status code indicating whether there is an error. 0: connection succeeded. 2: The installed HMS is out of date. |
| Method |
public abstract boolean isUserResolvableError(int errorCode) |
| Determines whether a failure can be resolved via user action. |
Parameters
| Parameter name | Parameter desc |
| errorCode | Error code. |
Return
| type | desc |
| boolean | true:A solution is available. false:No solution is available. |
| Method |
public abstract boolean isUserResolvableError(int errorCode, PendingIntent pendingIntent) |
| Determines whether a failure can be resolved via user action. |
Parameters
| Parameter name | Parameter desc |
| errorCode | Error code. |
| pendingIntent | Pending intent that can resolve the issue. |
Return
| type | desc |
| boolean | true:A solution is available. false:No solution is available. If pendingIntent is not null, it indicates that a solution is available. Otherwise, reference the error code. |
| Method |
public abstract void resolveError(Activity activity, int errorCode, int requestCode) |
| If pendingIntent is not null, it indicates that a solution is available. Otherwise, reference the error code. |
Parameters
| Parameter name | Parameter desc |
| activity | If pendingIntent is not null, it indicates that a solution is available. Otherwise, reference the error code. |
| errorCode | Error code. If the value of isUserResolvableError is true for a result code, the system supports error rectification through user operations. |
| requestCode | Request code given when calling the activity’s onActivityResult after an interaction operation. |
| Method |
public abstract void resolveError(Activity activity, int errorCode, int requestCode, PendingIntent pendingIntent) |
| If an issue can be resolved through user operations, a notification or dialog box is displayed for the returned error code. |
Parameters
| Parameter name | Parameter desc |
| activity | Activity context used to resolve the failure. The activity’s onActivityResult method will be called after the user is done. |
| errorCode | Error code. If the value of isUserResolvableError is true for a result code, the system supports error rectification through user operations. |
| requestCode | Request code given when calling the activity’s onActivityResult after an interaction operation. |
| pendingIntent | Pending intent that can resolve the issue. The pending intent is used if pendingIntent is not null. Otherwise, the solution supported by the system is used based on errorCode. |
| Method |
public abstract PendingIntent getResolveErrorPendingIntent(Activity activity, int errorCode) |
| Constructs a pending intent that can resolve the issue. |
Parameters
| Parameter name | Parameter desc |
| activity | Activity on the page. |
| errorCode | Error code. If the value of isUserResolvableError is true for an error code, the system supports pending intent creation based on the error code. |
Return
| type | desc |
| PendingIntent | Intent that can be used to resolve the issue through user interaction. |
| Method |
public abstract Intent getResolveErrorIntent(Activity activity, int errorCode) |
| Constructs a pending intent that can resolve the issue. |
Parameters
| Parameter name | Parameter desc |
| activity | Activity context used to resolve the failure. The activity’s onActivityResult method will be called after the user is done. |
| errorCode | Error code. If the value of isUserResolvableError is true for an error code, the system supports pending intent creation based on the error code. |
Return
| type | desc |
| Intent | Intent that can be used to resolve the issue through user interaction. |
| Method |
public abstract Dialog getErrorDialog(Activity activity, int errorCode, int requestCode) |
| Displays a notification/dialog box for the error code returned by the isHuaweiMobileServicesAvailable(Context, int) method. |
Parameters
| Parameter name | Parameter desc |
| activity | Activity context to use. |
| errorCode | Error code. If the value of isUserResolvableError is true for an error code, the system supports Notification or dialog box creation based on the error code. |
| requestCode | Request code, which is used for transparent transmission. |
Return
| type | desc |
| Dialog | Notification/Dialog box. |
| Method |
abstract Dialog getErrorDialog(Activity activity, int errorCode, int requestCode, DialogInterface.OnCancelListener onCancelListener) |
| Displays a notification/dialog box for the error code returned by the isHuaweiMobileServicesAvailable(Context, int) method. |
Parameters
| Parameter name | Parameter desc |
| activity | Activity context to use. |
| errorCode | Error code. If the value of isUserResolvableError is true for an error code, the system supports Notification or dialog box creation based on the error code. |
| requestCode | Request code, which is used for transparent transmission. |
| onCancelListener | Processing when the dialog is canceled. |
Return
| type | desc |
| Dialog | Notification/Dialog box. |
| Method |
public abstract String getErrorString(int errorCode ) |
| Human-readable string of the error code returned from isHuaweiMobileServicesAvailable(Context, int). |
Parameters
| Parameter name | Parameter desc |
| errorCode | Error code. |
Return
| type | desc |
| String | Description mapping the error code. |
| Method |
public abstract boolean showErrorDialogFragment (Activity activity, int errorCode, int requestCode) |
| Creates and displays a dialog box for an error code. |
Parameters
| Parameter name | Parameter desc |
| activity | Parent activity for creating the dialog. |
| errorCode | Error code returned by the isHuaweiMobileServicesAvailable(Context, int) method. |
| requestCode | Request code, which is used for transparent transmission. |
Return
| type | desc |
| boolean | true: if a dialog box is displayed; false: if no dialog box is displayed. |
| Method |
public abstract boolean showErrorDialogFragment (Activity activity, int errorCode, int requestCode, DialogInterface.OnCancelListener cancelListener) |
| Creates and displays a dialog box for an error code. |
Parameters
| Parameter name | Parameter desc |
| activity | Parent activity for creating the dialog. |
| errorCode | Error code returned by the isHuaweiMobileServicesAvailable(Context, int) method. |
| requestCode | Request code, which is used for transparent transmission. |
| onCancelListener | Processing when the dialog is canceled. |
Return
| type | desc |
| boolean | true: if a dialog box is displayed; false: if no dialog box is displayed. |
| Method |
public abstract void showErrorNotification(Context context, int errorCode) |
| Creates and displays a dialog for an error code. |
Parameters
| Parameter name | Parameter desc |
| context | System context. |
| errorCode | Error code returned by isHuaweiMobileServicesAvailable(Context, int). |