Returns a new task based on the result of Callable execution. Callable is executed in the main thread.
Google API | To HMS API |
|---|---|
public static <TResult> com.google.android.gms.tasks.Task<TResult> call(java.util.concurrent.Executor,java.util.concurrent.Callable) | public static <TResult> com.huawei.hmf.tasks.Task<TResult> callInBackground(java.util.concurrent.Executor executor, final java.util.concurrent.Callable<TResult> callable) HMS class: com.huawei.hmf.tasks.Tasks |
public static <TResult> com.google.android.gms.tasks.Task<TResult> call(java.util.concurrent.Callable) | public static <TResult> com.huawei.hmf.tasks.Task<TResult> callInBackground(java.util.concurrent.Executor executor, final java.util.concurrent.Callable<TResult> callable) HMS class: com.huawei.hmf.tasks.Tasks |
This method is called to connect the client to HMS. The method returns immediately, and connects to the service in the background.
Google API | To HMS API |
|---|---|
abstract void connect() | abstract void connect(android.app.Activity activity) The check for null values has been performed in activity. Corresponding HMS class: com.huawei.hms.api.HuaweiApiClient Note: If this API is used for the fitness service, replace GoogleApiClient with HiHealthKitClient and use the HiHealthKitClient.connect() API to connect to HUAWEI Health Kit. For details, please refer to the To HMS API instructions for the add API. |
This method is called to enable automatic lifecycle management.
Google API | To HMS API |
|---|---|
public final com.google.android.gms.common.api.GoogleApiClient.Builder enableAutoManage(androidx.fragment.app.FragmentActivity, com.google. android.gms.common.api.GoogleApiClient.OnConnectionFailedListener) | public com.huawei.hms.api.HuaweiApiClient.Builder allowLifeCycleManagement(android.app.Activity activity, com.huawei.hms.api.HuaweiApiClient.OnConnectionFailedListener unresolvedConnectionFailedListener) unresolvedConnectionFailedListener: OnConnectionFailedListener callback Corresponding HMS class: com.huawei.hms.api.HuaweiApiClient |
public final com.google.android.gms.common.api.GoogleApiClient.Builder enableAutoManage(androidx.fragment.app.FragmentActivity, int, com.google. android.gms.common.api.GoogleApiClient.OnConnectionFailedListener) | public com.huawei.hms.api.HuaweiApiClient.Builder allowLifeCycleManagement(android.app.Activity activity, int clientId, com.huawei.hms.api.HuaweiApiClient.OnConnectionFailedListener unresolvedConnectionFailedListener) clientId can be automatically converted, and the original input parameter can be reused. unresolvedConnectionFailedListener: OnConnectionFailedListener callback Corresponding HMS class: com.huawei.hms.api.HuaweiApiClient |
This method is called to obtain the PendingIntent object that contains a solution.
Google API | To HMS API |
|---|---|
public final android.app.PendingIntent getErrorPendingIntent(int, android.content.Context, int) | public abstract android.app.PendingIntent getErrPendingIntent(android.app.Activity activity, int errorCode, int requestCode) errorCode: result code requestCode: request code HMS class: com.huawei.hms.api.HuaweiApiAvailability |
This method is called to obtain the PendingIntent object that contains a solution.
Google API | To HMS API |
|---|---|
android.app.PendingIntent getErrorResolutionPendingIntent (android.content.Context, com.google.android.gms.common.ConnectionResult) | android.app.PendingIntent getErrPendingIntent(android.app.Activity activity, com.huawei.hms.api.ConnectionResult result) result: This class describes the result code returned when all clients fail to connect to HMS. HMS class: com.huawei.hms.api.HuaweiApiAvailability |
android.app.PendingIntent getErrorResolutionPendingIntent (android.content.Context, int, int) | android.app.PendingIntent getErrPendingIntent(android.app.Activity activity, int errorCode, int requestCode) errorCode: result code requestCode: request code HMS class: com.huawei.hms.api.HuaweiApiAvailability |
This method is called to obtain the SDK version number.
Google API | To HMS API |
|---|---|
public static final int GOOGLE_PLAY_SERVICES_VERSION_CODE = 12451000 | public static int SERVICES_VERSION_CODE = 30000100 HMS class: com.huawei.hms.api.HuaweiApiAvailability |
This method is called to automatically update and install the platform security control.
Google API | To HMS API |
|---|---|
public static void installIfNeeded(android.content.Context) | public static void install(android.content.Context context) Corresponding HMS class: com.huawei.hms.security.SecComponentInstallWizard |
Obtains the execution class instance of the UI main thread.
Google API | To HMS API |
|---|---|
java.util.concurrent.Executor MAIN_THREAD | public static Executor uiThread() HMS class: com.huawei.hmf.tasks.TaskExecutors |
This method is used for callback of cancelled tasks.
Google API | To HMS API |
|---|---|
public abstract com.google.android.gms.tasks.CancellationToken com.google.android.gms.tasks.CancellationToken.onCanceledRequested (com.google.android.gms.tasks.OnTokenCanceledListener listener) | public abstract com.huawei.hmf.tasks.CancellationToken com.huawei.hmf.tasks.CancellationToken.register(java.lang.Runnable action) |
This method is called asynchronously when the connection is successful after the connect(Activity) method is called. After this method is called back, the app can perform other requests provided by the client.
Google API | To HMS API |
|---|---|
void onConnected(android.os.Bundle param) | void onConnected() Corresponding HMS class: com.huawei.hms.api.HuaweiApiClient.ConnectionCallbacks |
This method is called when installation of the provider succeeds.
Google API | To HMS API |
|---|---|
void onProviderInstalled() | abstract void onSuccess() Corresponding HMS class: com.huawei.hms.security.SecComponentInstallWizard.SecComponentInstallWizardListener |
This method is called when installation of the provider fails.
Google API | To HMS API |
|---|---|
void onProviderInstallFailed(int, android.content.Intent) | abstract void onFailed(int errorCode, android.content.Intent recoveryIntent) errorCode: result code recoveryIntent: solution Corresponding HMS class: com.huawei.hms.security.SecComponentInstallWizard.SecComponentInstallWizardListener |
This method is called to show the dialog.
Google API | To HMS API |
|---|---|
public void show(androidx.fragment.app.FragmentManager, java.lang.String) | public void show(android.app.FragmentManager manager, java.lang.String tag) Corresponding HMS class: com.huawei.hms.common.ErrDlgFragmentForSupport |
This method is called to show the result code returned by the isHuaweiMobileServicesAvailable parameter in ErrorDialog.
Google API | To HMS API |
|---|---|
public final boolean showErrorDialogFragment (int, android.app.Activity,androidx.fragment.app. Fragment, int, android.content.DialogInterface.OnCancelListener) | public static boolean popupErrDlgFragment(int errorCode, android.app.Activity activity, android.app.Fragment fragment, int requestCode, android.content.DialogInterface.OnCancelListener cancelListener) requestCode: request code Corresponding HMS class: com.huawei.hms.api.HuaweiMobileServicesUtil |
This method is called from the main thread to disconnect the client and stop automatic lifecycle management before a new client is created.
Google API | To HMS API |
|---|---|
abstract void stopAutoManage(androidx.fragment.app.FragmentActivity lifecycleActivity) | public abstract void disableLifeCycleManagement(android.app.Activity activity) activity can be automatically converted, and the original input parameter can be reused. Corresponding HMS class: com.huawei.hms.api.HuaweiApiClient |
This method is called to set exceptions.
Google API | To HMS API |
|---|---|
public boolean com.google.android.gms.tasks.TaskCompletionSource<TResult>.trySetException (java.lang.Exception exception) | public void com.huawei.hmf.tasks.TaskCompletionSource<TResult>.setException(java.lang.Exception exception) |
This method is called to set the API call result.
Google API | To HMS API |
|---|---|
public boolean com.google.android.gms.tasks.TaskCompletionSource<TResult>.trySetResult (TResult result) | public void com.huawei.hmf.tasks.TaskCompletionSource<TResult>.setResult(TResult result) |