Compass for android (orientation in 3D space)

by mboehmer » Mon, 29 Dec 2008 18:19:14 GMT

Sponsored Links

mobile phones usually show the point of the compass, when people are
on the move (estimation of a vector from gps track). The API says,
that android is also able to get the point of the compass. How is this
done? Is this done by software (estimating the vector) or has the G1
an build-in magnetic hardware compass? If not, does anyone know, if it
is possible to connect a magnetic compass via USB or bluetooth?

I am interested in the orientation of the phone in 3D space, while the
user is standing still. Does anyone know, how wikitude (http:// does this?

Best regards


Compass for android (orientation in 3D space)

by DSmith » Mon, 29 Dec 2008 23:44:16 GMT

 The easiest way is to use SENSOR_ORIENTATION ( 
SensorManager.html#SENSOR_ORIENTATION).  It does all the necessary
calculations on the magnetometer and accelerometer values, throws in
some low-pass filtering, and spits out azimuth, pitch, and roll.  The
calculations aren't perfect - you'll see some strange things at the
branch cuts, like the az spinning backwards through the entire range
when you raise the phone over your head, but it's pretty good for most
practical uses.

Sponsored Links

Other Threads

1. Service Vs Thread

Hi all,

I have a question what to Use ,Service Or Thread,as both run in the


2. video resolution 3gp file

Hi ,

I'm facing a problem in video resolution.

In surfaceflinger/LayerBase.cpp, i've substituted the texture creation
procedure of using glTexImage2D and glTexSubImage2D APIs.  These were
blocking in the h/w graphics libraries provided by the vendor.

Now , I'm creating texture using eglCreateImageKHR and
glEGLTargetTexture2DOES APIs and I'm successfully able to bring up
Android screen and workaround most of the things.  But when I play a
3gp or mp4 file using the pvplayer, my video size is seen in full
screen but, i see only part of the video in the full screen. Part of
video appears to be cut.

If I comment setMeasuredDimension API in I'm able to
see the video properly playing in its original size, which i believe
is prooving that there is no problem in texture creation method I used
in LayerBase.cpp

Also If I revert back the texture creation procedure in LayerBase.cpp,
I'm able to see a proper video in full screen too.

If anyone has any idea on this, please help



3. Replace dialer application by installing another dialer app

4. dalvik and defineClass

5. mod JIT spica yang stabi

6. undangan miring

7. programmatically setup an ad-hoc network