android - How to get compass direction -


i want show direction on screen phone facing. example:

   0    |- []    |_   south --- north 

in above diagram phone display "north". since user (the stick 0 head) holding out phone (the [] in diagram) pointing north.

i found this example. understand it's doing except seems calculate yaw, pitch, roll, , inclination. , how use them find way phone pointing?

also android documentation mentions x, y, , z axises don't see anywhere says how axises correspond phone? z going bottom of phone top?

this how axis (axiy?) like.

i couldn't find link cheat sheet use, looked sort of this.

in summary, want register listen sensor.type_orientation, incoming array of values get, value[0] , should show angle (from north believe).

some example *android.com


Comments

Popular posts from this blog

ruby - When to use an ORM (Sequel, Datamapper, AR, etc.) vs. pure SQL for querying -

php - PHPDoc: @return void necessary? -

c++ - Convert big endian to little endian when reading from a binary file -