iOS location significant change accuracy and distance - ios

I want to know the accuracy and the distance filter of the low-power significant change location service (i.e if I use startMonitoringSignificantLocationChanges how much it's accurate, and what is the distance of the significant change)?
I need some experimental (non documentary) info from real time apps

I had a chance to speak with the Apple Location Engineers at WWDC this past year and this is how it was explained to me.
The significant location change is the least accurate of all the location monitoring types. It only gets its updates when there is a cell tower transition or change. This can mean a varying level of accuracy and updates based on where the user is. City area, more updates with more towers. Out of town, interstate, fewer towers and changes.
This is also the hardest location type to test for since you can't use the simulator either. I'm not sure if they have fixed it to work with the GPX files for 6.0, but the significant location change api did not work at all in the simulator prior to iOS 6.
I have tried to avoid using the signification location change for many of these reasons. Sometimes it can't be helped. I ended up using the region monitoring API's as they are far more accurate and just as good on battery life. Hope this helps.

From the Apple documentation:
This interface delivers new events only when it detects changes to the
device’s associated cell towers, resulting in less frequent updates
and significantly lower power usage.
There doesn't appear to be much more specific information available about the exact accuracy, so I would assume you have accuracy roughly equivalent to the approximate distance between cell towers in the area that the iOS device is currently located in (which is shorter in more highly populated areas).

I had to build an app back then that uses cell tower significant location changes.
Short answer: very inaccurate.
I was clearly crossing the boundaries of my region.
From what we observe in our app, it can be a few hundred metres to a few kilometres off. Our testing was in the city area, cell towers in suburbs parellel to the train tracks and other suburban cell towers.
Pretty rough.
It was consistent most of the time. I notice that every time I was about to go into the tunnel to the underground train station, it would fire off my 3 region crossing notifications that I have setup for the CBD city area.

I'm using Xcode 4.6.2, and you can indeed simulate significant location change on this simulator.
In the iOS Simulator, the menu entries you need are Debug->Location->Freeway Drive.
Caveats (I welcome being told I'm wrong):
1. After a long while, there seem to be no more significant location change events.
2. You can only drive a pre-defined route in the general Cupertino/SF area. If all you care about is significant location change, that's fine.

Be careful, although you can access the speed property of the location got from the significant location update, it's useless! the simulator actually gives the speed but in real devices the speed is not available because location got from cell towers will not include the actual speed(unlike GPS). more the that as said before the location itself is very inaccurate it can be a few km off.
Be aware of that.
The only way to get the speed is have two cllocation and compute the speed manually

Related

iOS Geofencing; will this be more accurate than what I have now?

I am by no means an iOS developer, and am just hacking something basic together for myself. Sorry if this is too beginner of a question.
I'm trying to collect my own location data from my phone to my own back-end service. Looking around, I found a sample project to collect location info: https://github.com/chriseidhof/PostGPS/
From the looks of things, this project uses significant location update, so even though I changed my desired accuracy to 100 meters, the app will still only provide update when enough cell towers have changed.
Instead, I'm thinking of using geofencing (CLCircularRegion) by creating grids of 3x3 geofences with 500 meter radius (with maybe a 50 meter overlap between each region), and each time I exit the central region, a new set of 3x3 geofences gets generated.
My questions are as follows:
Is this (the deleting and re-fencing part) a correct use of geofencing on iOS?
Is this going to be more accurate than what I currently have?
Will this significantly negatively affect my battery life?
The problem with using geofencing is that you can't monitor more than 20 regions at a time(OS limitation). It's better to use significant location changes. It is triggered while you're in foreground or background and the location is updated if the cell tower has changed or you have opened the app while the app was not in memory. But this method will be triggered only in the intervals of 15 mins. So even if the cell tower changes rapidly, this method will be invoked only once in 15 mins.
So if you want to update the location in background keeping in mind the battery usage as well, use significant location api.

Indoor Atlas: iOS SDK doesn't give accurate position when device stops moving

I downloaded the Indoor Atlas iPhone SDK and also generated path maps and test paths for my venue. SDK navigates me perfectly when I am moving from one place to another but when I stop moving it generates scattered output with the position radius from 10 to 25. I am expecting precise co-ordinates in both the above cases in my project.
Is there any way to get more precision?
IndoorAtlas technology is using the history of magnetic field observations for computing the precise location. This means that the device needs to move some distance in order to collect enough data to converge to a correct location estimate, i.e., to have a location fix. We are constantly improving our service to decrease the time needed for the first location fix.
If you experience your position moving after you've already stopped walking yourself, please contact support#indooratlas.com with details of your application and venue where this is experienced and we'll look into it. Thanks!

ios "smart" location tracker and battery drain

I'm creating an activity tracker similar to the "Moves" app that seeks to track steps, distance, calories and active time.
For Iphone5s+ devices, I am using the built in M7 chip to determine Steps, and then making estimates at the rest from that. For M7 devices I never use GPS. There is basically no battery drain and the interpolated numbers are reasonable enough for the need. This gets walking/running data reasonably enough.
However to support Iphone5 and Iphone4 at least, I need to use GPS to get location and then interpolate steps and calories from the distance. I'm running into significant battery drain issues (somewhat expected), and am seeking advice on how to minimize this. I'm also using the accelerometer in addition to speed to help make an educated guess on activity type (walking,running,biking,transport)
Some things I've tried for GPS optimization:
Deferred Updates: The Iphone5 and a minimum version of IOS supports this. The code to do this is straight forward, however whether the device actually uses it is questionable. I've only seen it work on 1 out of 4 devices, where it does regularly. 3 other devices have never deferred updates from the same code. Another user suggested other apps prevent the device from sleeping, including when I had "Moves" also installed. This thus hasn't helped much beyond theory.
Reduce Accuracy: reduce the accuracy of continuous location polling. I started at High, but reduced to 10m, then hundreds of meters, etc. This doesn't seem to help and polling still seems to occur at a regular interval anyway.
startMonitoringSignificantLocationChanges: In order to reduce endless gps polling when the user may not be moving for hours at a time (especially at night), I switched from continuous polling to significant changes only after the device stopped moving for an arbitrary 2 minutes. I then re enable continuous tracking after any significant location update. This works pretty much as expected-- if it stops tracking then battery drain slows, and when it resumes continuously, battery drain resumes. Further, if a user starts walking, there is no guarantee of a significant motion event for some time. This is very poor for accuracy. Sometimes it doesn't seem to resume at all.
I've been relatively impressed that the "Moves" app, among others is able to track location so well with respectable battery drain. It can go most of a day until needing a charge. With my code, users have reported full battery drain in a couple of hours.
What kind of optimizations could be used to improve this but still maintain a reasonable accuracy in tracking movement?
PROGRESS UPDATE:
startMonitoringSignificantLocationChanges. I set this up with a timer that switches to significant monitoring after 2 minutes of inactivity (not moving). Normal location tracking is then resumed again on any significant change, or when the app becomes active from reopening. This seems to work well. My phone still goes from 100% to 10% in 8 hours overnight of sitting around. It is an old iphone with some battery troubles, but normally it might just lose 30-40% uncharged overnight with no apps running. I need to test more, but startMonitoringSignificantLocationChanges still seems to use some battery.
Further, startMonitoringSignificantLocationChanges has some expected accuracy issues in terms of when it restarts the app. In rural setting, it can go several kilometers before restarting. This could be okay for a long drive, but if I want to catch a 30 minute walk, it may miss that entirely. In urban setting it seems to kick in within 2-3 blocks of movement, which is reasonable.
Even if I used continuous location tracking that stopped+started on a timer to check for movement, I'd still likely have worst case of a minute of lag between restarts before resuming continuous logging.
PROGRESS UPDATE 2:
Significant change updates described above have a fatal flaw for me: they don't always start fast enough. Sometimes it takes 1-2 miles it seems!
As an a better approach, I've tried keeping continuous location updates on, but toggling the "desiredAccuracy" property from high to low accuracy when the device is not moving. This should essentially turn the GPS receiver off during inactivity. I've been experimenting between 100meter and 1km accuracy for inactivity with promising results. It does seem to use slightly more batter than only using significant change monitoring, but it seems more responsive as well.
Nothing of your above proposed solutions works.
You need GPS, and that is enabled if you speficiy full precision (CLLocationAcuracyBest).
if I remeber correctly there is a difference betwween CLLocationAcuracyBest and CLLocationAcuracyBestForNavigation that way that the latter uses additonaly the acceleration sensor, which in sum uses more battery.
There is no half battery GPS mode!
A GPS chip is enabled or not.
For distance counting you need GPS, cell Tower and Wlan locations will not work.
And only the cell tower an Wlan locationg can save battery.
On Iphone4 such an full precision GPS App (e.g my) lasts about 8 hours untill the battery is low.
8 hours are enough, if the user has a benefit of the app.

CLRegion hidden buffer?

After coming across this question, I am concerned that there will not be an answer to the question, but I will hope, anyways.
I have setup a few geofences (most small and one large). I am using the simulator and I have outputted the radius of the large CLRegion and it tells me that the radius is 10881.98m around a certain coordinate, but when I simulate the geolocation to 11281.86m away from that same certain coordinate, it does not trigger the locationManager:didExitRegion: delegate method for the large region.
While the large region will not trigger locationManager:didExitRegion:, I have confirmed that the smaller regions will trigger the delegate method every time. Is there a reason why this is not firing? Is there a distance buffer around a region? Is it documented somewhere?
Any help would be great.
EDIT: From testing, I need to cut down the radius by around 45.28% in order to have the geofence trigger. Obviously this is not a great solution, as it is very imprecise and it goes against the whole idea of geofencing.
My guess is that this is an issue unique to the simulator. While CLRegion does not technically have a buffer or padding, the OS takes substantially longer to determine you have physically left the geofence area. On fences of that size, I would image it could take longer. On smaller regions, 100-200M, I've seen it take several minutes of driving, but easily 300-400M before triggering an event. From what the Apple Engineer told me at WWDC 2013, the OS takes its time in determining that you left. It is also harder for the system to determine you left because of its reliance on cell tower triangulation and known wifi networks. It needs to go well beyond the known networks before it can safely trigger the exit event.
I know it isn't an exact answer, but hopefully you'll understand a bit more how they work under the hood and what Apple's expectation of them is. Good luck.

why did didupdatelocation be called when device is not moved

i use CLLocation for a app that record people's trace in map view when they are running or walking ,but i found when my device is still (not moved) ,the
- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations is also get called frequently ?
currently ,my locationmanager's desiredAccuracy is 10 meters and distanceFilter is 10.
how to deal with this situation? I have tried use big distancefilter value(like 150) ,but I found if i do this, then i can't record exactly when people is running or walking
GPS is not exact. You can move around a few feet and get the same location. Or you can sit still and get told you have moved a few feet.
You might be able to combine measurements from the accelerometer to determine if you have really moved but this would only work if the device was sitting on a table not moving.
Have you called stopUpdatingLocation after the initial startUpdatingLocation? It will keep updating location if you do not call it.
How does system know whether or not you have actually moved? It MUST fetch your location to find out. The more accurate your desired accuracy is, the more vigorously and frequently it would look. By vigorous I mean if it's suppose to use cell-tower information then it would look into more cell-towers to better triangulate. Or simply put it, the interval between its fetches would be smaller. Concluding: OS would fetch data even if you don't move.
Additionally to triangulate your position the OS (depending on your desiredAccuracy and previous movements) would use a mix of GPS, wifi, Cell-tower. And because someone may all of sudden turn off/on their wifi, or satellite that you were using to get your location has moved a bit or the satellites have changed, or a cell-tower signal may become more or less accurate due to its bandwidth limitations then your calculated location may change which triggers a callback if it's more than your distanceFilter. ( I don't believe you get callbacks for less than your distanceFilter, but I may be wrong) This likely means your distanceFilter is set to very small number which depending on your business requirements may or may not be a good choice. Concluding: your location is never ever 100% accurate
The result of periodical fetching, possibility of error and small distanceFilters lead to possible incorrect locationChanges.

Resources