This example shows hot to read the user's activity using Activity Recognition Transition API.
In this post I explain more in details the difference between how we had to do it before and how we should do now with the transition API:
https://proandroiddev.com/new-activity-recognition-transition-api-f4cdb5cd5708