2

Upon my research, I realised Google's Activity Recognition API allows you to detect the activity a phone user is undertaking (walking, driving, etc), but I want to detect a change in transition. I want to know if this transition occurs: (walking to driving) or (driving to walking). As soon as a user enters a geofence, I want to listen for this change (driving to walking) or (walking to driving). How do I achieve this?

2 Answers2

0

We can use ActivityTransitionRequest to check the transition.

Here is an example that I found

https://github.com/Thumar/Activity-Recognition-Transition-API

With this you can achieve it . I am a newbie to android so I am still figuring out how to write similar thing and get it working . Here is some doc reference that can help you .

https://developer.android.com/guide/topics/location/transitions

https://developers.google.com/android/reference/com/google/android/gms/location/ActivityTransitionEvent

nsivaram90
  • 141
  • 1
  • 1
  • 11
0

If you want you can get when the user ends walking and starts driving. You have to subscribe to activities walking and Driving and the transition exit and start.

You can check this post:

https://proandroiddev.com/new-activity-recognition-transition-api-f4cdb5cd5708

I hope it helps you.

J.Arroyo
  • 176
  • 6