(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
locmanager = [[CLLocationManager alloc] init];
[locmanager setDelegate:self];
[locmanager setDesiredAccuracy:kCLLocationAccuracyHundredMeters];
[locmanager setDistanceFilter:10];
[locmanager startUpdatingLocation];
[window makeKeyAndVisible];
return YES;
}
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
CLLocationCoordinate2D loc = [newLocation coordinate];
latitude = [NSString stringWithFormat: @"%f", loc.latitude];
longitude= [NSString stringWithFormat: @"%f", loc.longitude];
//Call to the web service for sending data
}
當手機啓動時,是否可以自動啓動此應用程序?我不希望用戶啓動此應用程序。啓動GPS應用程序即服務
當應用程序在後臺運行時,是否可以將數據發送到服務器。 – agupta 2010-11-03 22:57:22
不是真的 - 只有當您安排後臺任務時。你有10分鐘時間來完成後臺任務。 – Moshe 2010-11-03 23:12:40
我在某處讀到,當您調用startMonitoringSignificantLocationChanges時,位置服務將使用單元格定位監視位置更改,而不管您的應用程序是否正在運行,然後在發生位置更改時啓動應用程序。 這是否有意義... – agupta 2010-11-03 19:30:56