• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Camera API / GPS / Compass?

theBorneo

Lurker
Hi all,

How to get Camera direction of GPS enabled phone?

All i found about GPS is that it just tells the location of the device, how do one get the direction where camera is pointing with GPS enabled phone?

For example, I need to see the camera api and work out which direction the camera is pointing. So that I can see the direction I'm viewing. In the other word, it is work like a compass.

Can anyone assist me on this or any suggestion tutorials or website to look at?

Much appreciated.
theBorneo
 
You shouldn't rely on the GPS sensor to tell you which way you are looking. The direction given by the GPS is based on your prior movement, meaning that you would have to move a considerable distance while looking in that same direction to get anything precise.

You need to use the magnetic sensor and the accelerometer to get the compass direction of the phone. Here is an example of how it is done:

Coding for Android: Using orientation sensors: Simple Compass sample

HF
 
Thanks for the thoughts JamTheMan - One question though -- How does android mob work with the data? Say for example one of this app that has been created (star walk) - where do you keep the database? Does most android use SQLite? If yes, how does it works?

For example on this scenario, where you keep the names of the stars? images? etc etc. What kind of data be held in tables in the database and how does it incorporate with the android? Any suggestion?
 
Back
Top Bottom