views:

142

answers:

2

Is there a way to keep timers running when an App enters background mode without location services running?

If I have a timer running in the App with location services on and enter the background then it keeps running. However calling stopUpdatingLocation also stops the timer. I would like the timer to be able to call startUpdatingLocation at some point in the furture but as it not being run it can't do this.

Any information on how multi-tasking works with location services would be helpful.

A: 

You should probably figure out when (at what time) the timer would call startUpdatingLocation and add a UILocalNotification at that time.

Larsaronen
Thanks for replying. I've tried using UILocalNotification but can't get it to work without it displaying a message on the screen when the App is in the background. Am I missing something?
Andy
yourNotification.hasAction = NO;
Larsaronen
A: 

I want to run my app keep running in the background with location services. For this I have used:

  • (void)applicationDidEnterBackground:(UIApplication *)application {

    [locationManager stopUpdatingLocation];
    

    [locationManager startUpdatingLocation];

    //timer=[NSTimer scheduledTimerWithTimeInterval:300 target:self selector:@selector(UpdateLocation) userInfo:nil repeats:YES];
    

}

but when i user timer,it does not call UpdateLocation. I called it using another method but then also it is called only once.

I want to run app continously in the background, detecting locations after regular interval of time.

Can any one please suggest any idea?

thanks in advance

Steve