Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Narendar Singh

macrumors member
Original poster
Jun 22, 2012
76
0
INDIA
My requirement is:

1) I have to send "device location" after every 3 hours to our server.
2) App may or may not be run while sending "device location" to the server.

For achieving this I found "significant-change location service" is suitable (supports from iOS 4.0 and later).

What I have done -
1) My Application Delegate is implementing CLLocationManagerDelegate.
2) From didFinishLaunchWithOptions: I am calling startMonitoringSignificantLocationChanges.
3) Implementing 2 delegate methods for successful location fix and its failure ie didUpdateToLocation: and didFailWithError:

What I am getting -
Each time I start the app I am getting my current location. Well at very first launch app asked me for allowing GPS fix from Settings.

I'm stuck on following points -
1) How to get new location after every 3 hours regardless of whether app is running or not.
2) How can I test this on my device. Do I need to physically move from one place to another for location change. Badly confused how to test the app.
3) When the service in background gets the new location what happens at that time, so that these new location I can send to my server. Please confirm.

If needed I can place full source code whatever I have written after googling.
 

jnoxx

macrumors 65816
Dec 29, 2010
1,343
0
Aartselaar // Antwerp // Belgium
I'm stuck on following points -
1) How to get new location after every 3 hours regardless of whether app is running or not.
2) How can I test this on my device. Do I need to physically move from one place to another for location change. Badly confused how to test the app.
3) When the service in background gets the new location what happens at that time, so that these new location I can send to my server. Please confirm.

If needed I can place full source code whatever I have written after googling.

Do you exactly know what significant changes are? when you change celltowers, it will give you a significant change.. so it can be 20 a minute if you're in a city, or 1ce per day if you're on a landside.
So basically
1) Not really possible I think, because you cannot ask it's location hard whenever you want it..
2) Just run it on your device, and fake locations via a method.
3) You can send stuff to your server when you found a new location via a locationmanager or so, (and check vs an NSDate if it's been 3 hours since last time or not).
 

Narendar Singh

macrumors member
Original poster
Jun 22, 2012
76
0
INDIA
Do you exactly know what significant changes are? when you change celltowers, it will give you a significant change.. so it can be 20 a minute if you're in a city, or 1ce per day if you're on a landside.
Got it.

This may be silly question, but is this possible to get new location if I switch from one to another wifi spot instead of celltowers switching. Please confirm.
 

Duncan C

macrumors 6502a
Jan 21, 2008
853
0
Northern Virginia
Got it.

This may be silly question, but is this possible to get new location if I switch from one to another wifi spot instead of celltowers switching. Please confirm.

Apple doesn't release a lot of detail about these APIs, so it's hard to be sure.

The documentation says that the significant changes API is only available for devices with a cellular radio, which suggests not.

Hoever, I have tested location services pretty extensively, and you do get regular location updates, at least, when you move between WiFi base stations, even on an iPod touch, which has neither a cell radio nor a GPS.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.