How to detect movement of an android device?

后端 未结 6 1494
日久生厌
日久生厌 2020-12-04 09:51

I need suggestion about how to detect the amount of movement of an android device. Suppose I have put the phone on a table or bed and then if somebody taps the table or sits

6条回答
  •  清歌不尽
    2020-12-04 10:50

    if you are trying to find the displacement of your phone, you need to find the Linear acceleration acting on your phone rather than the acceleration due to gravity

    android has a built in converter to find the LINEAR ACCELERATION acting on your mobile phone

    https://github.com/yuvaramsingh94/AndroidSensorTestCode/tree/master

    this is a code where you can see how to get the raw value of LINEAR ACCELERATION

提交回复
热议问题