iPhone Compass GPS Direction

There is a standard “heading” or “bearing” equation that you can use – if you are at lat1,lon1, and the point you are interested in is at lat2,lon2, then the equation is: heading = atan2( sin(lon2-lon1)*cos(lat2), cos(lat1)*sin(lat2) – sin(lat1)*cos(lat2)*cos(lon2-lon1)) This gives you a bearing in radians, which you can convert to degrees by multiplying by … Read more

Android GPS incorrect location data on query

From what is specified[difference of 4-5 blocks], you may be obtaining the location from networkProvider only. With this gpsTracker code mentioned in the question, there are a few modifications required, instead of using the code as it is: 1. There are 2 if loops which verify the source of location is enabled or not and … Read more

GPS coordinates in degrees to calculate distances

Why don’t you use CLLocations distanceFromLocation: method? It will tell you the precise distance between the receiver and another CLLocation. CLLocation *locationA = [[CLLocation alloc] initWithLatitude:12.123456 longitude:12.123456]; CLLocation *locationB = [[CLLocation alloc] initWithLatitude:21.654321 longitude:21.654321]; CLLocationDistance distanceInMeters = [locationA distanceFromLocation:locationB]; // CLLocation is aka double [locationA release]; [locationB release]; It’s as easy as that.

iOS GPS tracking app that runs all the time

You have two options here: 1) Regular location tracking. This type of tracking works with kCLAuthorizationStatusAuthorizedWhenInUse and kCLAuthorizationStatusAuthorizedAlways authorizations. When CLLocationManager started tracking location once it will receive location updates in delegate method locationManager:didUpdateLocations:. App can go to suspended state, but when location manager receive new location app goes to background state and handles new … Read more

ACCESS_COARSE_LOCATION permission gives a cell tower precision on Android

This is an interesting problem, and I was under the impression that using ACCESS_COARSE_LOCATION would use WiFi, since that’s what the documentation says. The documentation for ACCESS_COARSE_LOCATION states: Allows an app to access approximate location derived from network location sources such as cell towers and Wi-Fi. So, I put it to the test, and the … Read more

Calculate distance between two place using latitude-longitude in gmap for iPhone [duplicate]

You have to use Core Location Framework. So don’t forget to Add & import Core Location Framework. Objective-C #import <CoreLocation/CoreLocation.h> CLLocation *locA = [[CLLocation alloc] initWithLatitude:lat1 longitude:long1]; CLLocation *locB = [[CLLocation alloc] initWithLatitude:lat2 longitude:long2]; CLLocationDistance distance = [locA distanceFromLocation:locB]; //distance in Meters //1 meter == 100 centimeter //1 meter == 3.280 feet //1 square meter … Read more