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.
as-salaam-alaikum
Comments
Post a Comment