This is a just a simple example of how to use GooglePlay Service's ActivityRecognitionApi. Although this is a great library, it does not work on devices that do not have Google Play Services installed.
Docs for ActivityRecognition API
Manifest
<!-- This is needed to use Activity Recognition! -...