| class info |
| public final class BehaviorBarrier extends Object |
| Behavior barriers, including the beginning, ending, and keeping barriers of behaviors. |
| Type | Name | Desc |
| int | BEHAVIOR_IN_VEHICLE | The user is driving. |
| int | BEHAVIOR_ON_BICYCLE | The user is cycling. |
| int | BEHAVIOR_ON_FOOT | The user is walking or running. |
| int | BEHAVIOR_RUNNING | The user is running. |
| int | BEHAVIOR_WALKING | The user is walking. |
| int | BEHAVIOR_STILL | The user is still. |
| int | BEHAVIOR_UNKNOWN | Indicates that the current status of the user cannot be detected. Note: Unknown behavior barriers cannot be registered. |
| Return type | Method name |
| AwarenessBarrier | public static AwarenessBarrier keeping(int… behaviorTypes) |
| AwarenessBarrier | public static AwarenessBarrier ending(int… behaviorTypes) |
| AwarenessBarrier | public static AwarenessBarrier beginning(int… behaviorTypes) |
| Constant |
| public static final int BEHAVIOR_IN_VEHICLE |
| The user is driving. Constant Value: 0 |
| Constant |
| public static final int BEHAVIOR_ON_BICYCLE |
| The user is cycling. Constant Value: 1 |
| Constant |
| public static final int BEHAVIOR_ON_FOOT |
| The user is walking or running. Constant Value: 2 |
| Constant |
| public static final int BEHAVIOR_RUNNING |
| The user is running. Constant Value: 8 |
| Constant |
| public static final int BEHAVIOR_WALKING |
| The user is walking. Constant Value: 7 |
| Constant |
| public static final int BEHAVIOR_STILL |
| The user is still. Constant Value: 3 |
| Constant |
| public static final int BEHAVIOR_UNKNOWN |
| Indicates that the current behavior of the user cannot be detected. Note: Unknown behavior barriers cannot be registered. Constant Value: 4 |
| Method |
| public static AwarenessBarrier keeping(int… behaviorTypes) |
| Behavior barrier named keeping. After the barrier in a specified behavior status (excluding BEHAVIOR_UNKNOWN) is added, when a user is in the behavior status , the barrier status is TRUE and a barrier event is reported. |
| The android.permission.ACTIVITY_RECOGNITION permission must be added for Android 10 (API level 29) and later versions. |
| The com.huawei.hms.permission.ACTIVITY_RECOGNITION permission must be added for Android 9 (API level 28) and earlier versions. |
Parameters
| Parameter name | Parameter desc |
| behaviorTypes | One or more behavior type constants. |
Return
| Type | desc |
| AwarenessBarrier | Awareness barrier. |
Throws
| Parameter name | Parameter desc |
| IllegalArgumentException | The behaviorTypes parameter is empty or invalid, or set to BEHAVIOR_UNKNOWN. |
| Method |
| public static AwarenessBarrier beginning(int… behaviorTypes) |
| Behavior barrier named beginning. After the barrier in a specified behavior status (excluding BEHAVIOR_UNKNOWN) is added, when a user is in the behavior status, the barrier status is TRUE and a barrier event is reported. After 5s, the barrier status changes to FALSE. |
| The android.permission.ACTIVITY_RECOGNITION permission must be added for Android 10 (API level 29) and later versions. |
| The com.huawei.hms.permission.ACTIVITY_RECOGNITION permission must be added for Android 9 (API level 28) and earlier versions. |
Parameters
| Parameter name | Parameter desc |
| behaviorTypes | One or more behavior type constants. |
Return
| Type | desc |
| AwarenessBarrier | Awareness barrier. |
Throws
| Parameter name | Parameter desc |
| IllegalArgumentException | The behaviorTypes parameter is empty or invalid,or set to BEHAVIOR_UNKNOWN. |
| Method |
| public static AwarenessBarrier ending(int… behaviorTypes) |
| Behavior barrier named ending. After the barrier in a specified behavior status (excluding BEHAVIOR_UNKNOWN) is added, when a user stops the behavior, the barrier status is TRUE and a barrier event is reported. After 5s, the barrier status changes to FALSE. |
| The android.permission.ACTIVITY_RECOGNITION permission must be added for Android 10 (API level 29) and later versions. |
| The com.huawei.hms.permission.ACTIVITY_RECOGNITION permission must be added for Android 9 (API level 28) and earlier versions. |
Parameters
| Parameter name | Parameter desc |
| behaviorTypes | One or more behavior type constants. |
Return
| Type | desc |
| AwarenessBarrier | Awareness barrier. |
Throws
| Parameter name | Parameter desc |
| IllegalArgumentException | The behaviorTypes parameter is empty or invalid,or set to BEHAVIOR_UNKNOWN. |