I can get the GPS location in the background using [locationManager startUpdatingLocation]
, but I don't know how to schedule it. I have used NSTimer for scheduling but many of them are saying that NSTimer will get expire if the application enters background.
I want to know how to schedule calling the method , if we are not using NSTimers.
Apple provides 5 kinds of app task to run in background:
- Apps that play audible content to the user while in the background, such as a music player app
- Apps that keep users informed of their location at all times, such as a navigation app
- Apps that support Voice over Internet Protocol (VoIP)
- Newsstand apps that need to download and process new content
- Apps that receive regular updates from external accessories
Refer this link for location updates while app is in background
Also refer this tutorial for further help
We can use Push Notification instead of NSTimer for scheduling as shown:-
http://developer.apple.com/iphone/library/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Introduction/Introduction.html
Hope it helps.Thanks :)
I think you can use this :
[self performSelector:@selector(_yourMethod) withObject:nil afterDelay:delay_in_milliseconds];