java.lang.Object | |
↳ | com.google.android.gms.awareness.fence.DetectedActivityFence |
Use this class to create activity-based fences.
Note: Values that indicate a changing state are momentarily TRUE
for
about 5 seconds, then automatically revert to FALSE
.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | IN_VEHICLE | The device is in a vehicle, such as a car. | |||||||||
int | ON_BICYCLE | The device is on a bicycle. | |||||||||
int | ON_FOOT | The device is on a user who is walking or running. | |||||||||
int | RUNNING | The device is on a user who is running. | |||||||||
int | STILL | The device is still (not moving). | |||||||||
int | UNKNOWN | Unable to detect the current activity. | |||||||||
int | WALKING | The device is on a user who is walking. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
This fence is momentarily (about 5 seconds)
TRUE when the user begins to
engage in one of the activityTypes and the previous activity was
not one of the values in activityTypes . | |||||||||||
This fence is momentarily (about 5 seconds)
TRUE when the user stops one
of the activityTypes , and transitions to an activity that is not
in activityTypes . |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
The device is in a vehicle, such as a car.
The device is on a bicycle.
The device is on a user who is walking or running.
The device is on a user who is running. This is a sub-activity of ON_FOOT
.
The device is still (not moving).
Unable to detect the current activity.
The device is on a user who is walking. This is a sub-activity of ON_FOOT
.
This fence is in the TRUE
state when the user is currently engaged in
one of the specified activityTypes
, and FALSE
otherwise.
com.google.android.gms.permission.ACTIVITY_RECOGNITION
permission in AndroidManifest.xml, and the user must provide consent at
runtime.
Parameters | |
---|---|
activityTypes |
int :
Collection of activity type constants. Valid values
are the constants defined in this class. |
Returns | |
---|---|
AwarenessFence |
Awareness fence. |
This fence is momentarily (about 5 seconds) TRUE
when the user begins to
engage in one of the activityTypes
and the previous activity was
not one of the values in activityTypes
.
com.google.android.gms.permission.ACTIVITY_RECOGNITION
permission in AndroidManifest.xml, and the user must provide consent at
runtime.
Parameters | |
---|---|
activityTypes |
int :
Collection of activity type constants. Valid values
are the constants defined in this class. |
Returns | |
---|---|
AwarenessFence |
Awareness fence. |
This fence is momentarily (about 5 seconds) TRUE
when the user stops one
of the activityTypes
, and transitions to an activity that is not
in activityTypes
.
com.google.android.gms.permission.ACTIVITY_RECOGNITION
permission in AndroidManifest.xml, and the user must provide consent at
runtime.
Parameters | |
---|---|
activityTypes |
int :
Collection of activity type constants. Valid values
are the constants defined in this class. |
Returns | |
---|---|
AwarenessFence |
Awareness fence. |