Reputation: 3094
I am creating an application in that I need only current Latitude and longitude of the device using the GPS i.e. using iPhone4.
I just want to know Do I need the Wifi or internet connectivity or not ??
I do have operator card as well as my device will be jailbroken and also having 3g facility means iphone 3gs or iPhone 4.
So can I get Lat and Long for the same ?
thanks in advance.
Upvotes: 0
Views: 1993
Reputation: 4663
Yes you can use GPS for it as it doesn't need internet connection, but it
(1) takes a long time to get position and (2) doesn't work properly inside buildings or streets
By this way you can do it:
-(void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations{
CLLocation * currentLocation = [locations lastObject];
NSLog(@"%f",currentLocation.coordinate.longitude);
NSLog(@"%f",currentLocation.coordinate.latitude);
if (newLocation.horizontalAccuracy < 0) {
return;
}
NSTimeInterval interval = [newLocation.timestamp timeIntervalSinceNow];
if (abs(interval)>20) {
return;
}
}
Upvotes: 0
Reputation: 10510
Data connectivity is only used by A-GPS (Assisted GPS) to find and use satellites faster and better in conditions where there are poor radio signals. Standalone GPS, per se, does not require any data connectivity to perform its function. However, if you start your application or the iPhone in an area where signals are low or poor, and you don't have data connectivity, your device (and the GPS on-board) will not likely be able to connect to satellites to get location information.
Upvotes: 2