0

I am trying to figure out which google API can be used in order to detect whether the user is walking or just standing. Is there any API that requires only sensor values and not GPS?

Voila
  • 310
  • 2
  • 14

2 Answers2

1

You must use FusedLocationProviderApi in Android to get location of device and then fetch speed on the Location object.

If the speed is greater than 0, then you can say user is moving. The speed is in meter/second.

Refer Android Documentation to understand code : https://developers.google.com/android/reference/com/google/android/gms/location/FusedLocationProviderApi

Karan Sharma
  • 2,353
  • 4
  • 28
  • 46
1

I'd use step counter if available and fused location otherwise.

Step counter is lightest to use and consume less battery in comparison to fused location.

Even more, step counter allows indoor discovering.

Fused location might be not enough inside buildings and you'd probably have to use another solution like beacons. It gets more complicated here.

klimat
  • 24,711
  • 7
  • 63
  • 70
  • Fused location is accurate when GPS is on, right? – Voila Jul 21 '16 at 13:57
  • @TinaLooke as the name suggests fused location uses both GPS and Wifi. It can be used without GPS enabled but for best results it's better to turn it on. – klimat Jul 21 '16 at 15:10
  • The problem is that it makes it impossible to be accurate when indoors – Voila Jul 22 '16 at 06:44
  • 1
    @TInaLooke you can go ahead and use beacons https://developers.google.com/beacons/ when you're indoor. Step counter seems to be most relevant solution anyway :) – klimat Jul 22 '16 at 08:15