Qibla Compass in Android -


this question has answer here:

i have try can not make qibla compass application. cant understand .i need qibla compass work perfect me . parag

you know location of mecca , know users current location (if have gps or other location provider). bearing given formula, latitudes , longitudes should in radians.

float londelta = (lon2 - lon1); float y = math.sin(londelta) * math.cos(lat2); float x = math.cos(lat1) * math.sin(lat2) - math.sin(lat1) * math.cos(lat2) * math.cos(londelta); float brng = math.atan2(y, x).todeg(); 

brng direction in degrees.

you explore location.bearingto() method.

http://developer.android.com/reference/android/location/location.html#bearingto(android.location.location)

as-salaam-alaikum


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -