Case:
We need know current user activity.
Using ActivityRecognitionApi we can get if user driving, walking, running, ride bicycle.

Android get information from all the sensors and analyse it using ActivityRecognitionApi.

Below simple sample how to implement it.

Please follow the steps:

1. Create android project in Android Studio.
2. Add compile ‘com.google.android.gms:play-services-location:8.4.0’ dependency in build.gradle:

3. Modify AndroidManifest.xml and add
“com.google.android.gms.permission.ACTIVITY_RECOGNITION” uses-permission

4. Add ActivityRecognitionService which will handle the results.

6. Added Activity for visualisation.

Full source code here:

Download it from github

0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.