Orientation

Back | Tutorial Home

Orientation gives us the position in relation to Magnetic North or True North depending on the device capability. In layman’s terms it gives us the compass orientation. Location API uses Orientation class for this purpose. This class does has no dependencies on LocationProvider. This is the only class in the Location API that has no relation with LocationProvider. To get Orientation object use getOrientation() method.

Orientation orientation = Orientation.getOrientation();

Orientation class defines four parameters.

Azimuth: The compass azimuth relative to True North or Magnetic North.
Pitch: Vertical elevation angle.
Roll: Terminal's rotation in degrees around its own axis.
Orientation Method: Whether the orientation is with respect to True North or Magnetic North. The application should first check whether the orientation values are with respect to Magnetic North or True North and all manipulations should be done with respect to this orientation method.

You can find the orientation values by using the get Methods.

float azimuth = orientation.getCompassAzimuth();
float pitch = orientation.getPitch();
float roll = orientation.getRoll();
boolean magneticOrientation = orientation.isOrientationMagnetic();

j2meSasa goodies
Download demo code for deploying directly to WTK Click here to download Zip File Containing WTK compatible file structure. This zip file is a MIDlet suite of all the examples in this in this LBS tutorial

Conclusion

This concludes our article on LBS. J2ME’s nifty Location API gives us the power to build Location aware applications, however accuracy and feasibility of some of these API’s should be checked with respect to Target Devices. All these API’s may not be supported by some devices. Check your Target Device’s specification for more details.

Back | Tutorial Home

site comments powered by Disqus

More Tutorials

MIDP Basics
MIDP Gaming

This page is a part of a frames based web site. If you have landed on this page from a search engine click here to view the complete page.