简体   繁体   中英

using android sensor to get Direction when moving android device

i'm going to make an app that will get Direction when moving android device on ground from

  • left to right
  • top to bottom
  • right to left
  • bottom to top

at first i need to reset x and y position to 0
then by moving android device , get the values !

i'm new in android and i don't know is there any sensor for it or not .
so i didn't try any code to share it :|

is it possible ? any idea ?
is that any sensor that may help me ?

" i have to use android device on ground and i can't pick up the phone "

Yea there is a sensor event listener in android using this you can get your requirements done. This is the official documentation. This sample tutorial will help you to start.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM