开发者

Detecting the device moving direction using ACCELEROMETER in Android

开发者 https://www.devze.com 2023-01-30 09:19 出处:网络
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开发者_StackOverflow社区 if it moves DOWN direction and not up?

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开发者_StackOverflow社区 if it moves DOWN direction and not up?

thanks.


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).

0

精彩评论

暂无评论...
验证码 换一张
取 消