CLASS info
public class ActivityIdentificationService
Interaction access point of activity identification.

Public Method Summary

Return typeMethod name
Task<Void>deleteActivityConversionUpdates(PendingIntent pendingIntent)
Task<Void>deleteActivityIdentificationUpdates(PendingIntent callbackIntent)
Task<Void>createActivityConversionUpdates(ActivityConversionRequest activityConversionRequest, PendingIntent pendingIntent)
Task<Void>createActivityIdentificationUpdates(long intervalMillis, PendingIntent callbackIntent)

Public Methods

Method
public Task<Void> deleteActivityConversionUpdates(PendingIntent pendingIntent)
This API is used to remove activity conversion updates associated with the given pendingIntent object. The com.huawei.hms.permission.ACTIVITY_RECOGNITION (versions earlier than Android Q) or android.permission.ACTIVITY_RECOGNITION (Android Q and later versions) permission is required for calling this API. The permission requirements are the same as those of other activity identification APIs.

Parameters

Parameter nameParameter desc
pendingIntentpendingIntent associated with the activity conversion request to be removed.

Return

typedesc
Task<Void>Task. You can add addOnSuccesslistener() and addOnFailureListener() to obtain the execution result of the current method, and add getStateCode() to check whether the execution is successful.
Method
public Task<Void> deleteActivityIdentificationUpdates(PendingIntent callbackIntent)
This API is used to remove all activity identification updates from the specified PendingIntent object.

Parameters

Parameter nameParameter desc
callbackIntentPendingIntent request to be removed.

Return

typedesc
Task<Void>Task. You can add addOnSuccesslistener() and addOnFailureListener() to obtain the execution result of the current method, and add getStateCode() to check whether the execution is successful.
Method
public Task<Void> createActivityConversionUpdates(ActivityConversionRequest activityConversionRequest, PendingIntent pendingIntent)
This API is used to activity conversions (entering and exit), for example, detecting user status change from walking to bicycling.The Conversion API supports the following activity parameters.

Parameters

Parameter nameParameter desc
activityConversionRequestActivity conversion request
pendingIntentPendingIntent parameter. When building a PendingIntent object, you need to set Class and Action. Do not build an empty Intent object.

Return

typedesc
Task<Void>Task. You can add addOnSuccesslistener() and addOnFailureListener() to obtain the execution result of the current method, and add getStateCode() to check whether the execution is successful.
Method
public Task<Void> createActivityIdentificationUpdates(long intervalMillis, PendingIntent callbackIntent)
This API is used to register for activity identification updates.

Parameters

Parameter nameParameter desc
intervalMillisInterval for activity identification updates,in milliseconds. Larger values will result in fewer activity identifications. Smaller values will result in more activity identifications.
callbackIntentPendingIntent to be updated. When building a PendingIntent object, you need to set Class and Action. Do not build an empty Intent object.

Return

typedesc
Task<Void>Task. You can add addOnSuccesslistener() and addOnFailureListener() to obtain the execution result of the current method, and add getStateCode() to check whether the execution is successful.