Search code examples
androidgoogle-apigoogle-awareness

Always getting ON_FOOT from Google Awareness API Detection Activity. How to get sub-activity WALKING?


I am using the class DetectedActivity from the Google Awareness API. When I walk or run, I always get the response ON_FOOT.

For example, when I am just walking, I want to get back WALKING only but I still get ON_FOOT. I do see the following note in the documentation but it doesn't tell how to get the ON_WALKING sub-activity information too?

The device is on a user who is walking. This is a sub-activity of ON_FOOT.


Solution

  • You need to use getProbableActivities to get the full list of probable activities: while ON_FOOT will be the most probable activity, looking at the second most probably activity will return WALKING, RUNNING, etc.