0
(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

}

Will it be possible to start this application automatically when the phone starts.I don't want users to start this.

2 Answers 2

1

No, the only way for your application to start is for a user to start it, either by tapping on it on the home screen, or by opening it through a push notification.

CoreLocation runs in the background as part of iOS, but your app can only access that data when it is open. If it is running in multitasking mode, I imagine that you'd be able to access location data through a background task.

Note that a "Location" indicator will appear in the status bar on the right whenever you use Core Location. This is done for privacy reasons.

4
  • I read somewhere that When you call startMonitoringSignificantLocationChanges, the location service will monitor location changes using cell positioning, regardless of whether or not your app is running, and then launch your application when a location change occurs. Does this makes sense...
    – agupta
    Nov 3, 2010 at 19:30
  • Will it be possible to send data to a server when the application is running in background.
    – agupta
    Nov 3, 2010 at 22:57
  • Not really - only if you schedule a background task. You have 10 minutes to complete background tasks.
    – Moshe
    Nov 3, 2010 at 23:12
  • See if you can find a reference. I don't think so. CORRECTION: Yes, this is true, see this: developer.apple.com/library/ios/#documentation/CoreLocation/…
    – Moshe
    Nov 3, 2010 at 23:36
0

No. Not unless it's jailbroken.

2
  • This is really a comment, not an answer to the question. Please use "add comment" to leave feedback for the author.
    – The iOSDev
    Aug 18, 2012 at 10:25
  • The question was "Will it be possible to..." the answer (my answer) is "no".
    – Brad
    Sep 4, 2012 at 19:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.