taxman
taxman

Reputation: 501

Detecting the device moving direction using ACCELEROMETER in Android

Using the SensorManager I can find the x,y,z from the ACCELEROMETER. I can detect that the device moves, but how I can I check if it moves DOWN direction and not up?

thanks.

Upvotes: 2

Views: 2618

Answers (1)

Goz
Goz

Reputation: 62323

The value will be negative.

Edit: The value of y will be negative if its moving down. Positive if its moving up (I accept it may actually be the other way round and negative for up positive for down I've not played with the android accelerometer yet so I'm going on other accelerometers i have used).

Upvotes: 3

Related Questions