Making an application context-aware is one of the best ways to offer useful services to your users. There are a few ways to do this, including building applications that use geofences and other location services. This article focuses on using the Google Play Services Activity Recognition API to determine if the user is running, walking, in a vehicle, biking, or remaining still.
Knowing what activity the user is performing can allow you to cater the application experience, for example, by asking if the user is starting to exercise so you can keep track of it with Google Fit, or preventing notifications from being sent when the user is driving.
Source files for the Envato Tuts+ tutorial: How to Recognize User Activity With Activity Recognition
Read this tutorial on Envato Tuts+