On iOS we are using the GPS to track users.
We had a strange case last week where a user were moving quite good, and then suddenly one point from the GPS could be totally off (~500 meters), and then moved again and then suddenly a totally off point again (again about 500 meters).
We are using filter and have set the accuracy to only get good GPS-points, and these kind of bad GPS-coordinates is nothing we normally see.
Because of this behaviour I started to think about how the GPS works in iOS when multiple apps are using the GPS at the same time.
We require a good accuracy, We use kCLLocationAccuracyBestForNavigation or kCLLocationAccuracyBest. They should only use the GPS and not any wifi/cellular or similar. We also filter out anything with an accuracy (fault tolerance) higher than 130.
But what happen if another app is also using the GPS with the settings of kCLLocationAccuracyThreeKilometers. Could it be that our app receives those updates and therefore we get bad accuracy because of that?
Related
I am working on a feature in an iOS app to send location updates to our backend when there is a change in the location.
Initially, I had set minimalDistanceFilter(minimum change in location value) to none to send location updates. But it is making the network calls continuously and it can increase the load on the backend.
If some of you worked on this case earlier, I wanted to know how you solved it. What can be the minimalDistanceFilter?
I am also curious about how the above-listed apps work with location-related events.
The distanceFilter and the desiredAccuracy go hand-in-hand. For the distance filter, it can be anything between kCLDistanceFilterNone and CLLocationDistanceMax. See the documentation.
Regarding what other people used, it will vary widely from app to app. For navigation apps, you tend to need high accuracy so you don't miss a turn. But a weather app might be perfectly happy with city-level accuracy.
If you really need reasonable precision and want to reduce volume, then a filter of 5–15 meters is a good starting point. Try different values yourself and see what the effect is.
But there is no magical answer to your question. You will have to balance the legitimate needs of your app with (a) the server load; and (b) the power consumption on the device.
By the way, if the app doesn't need high accuracy, you might contemplate the very efficient, but less accurate, significant change service which will report changes of roughly 500 meters, with a frequency not exceeding once every 5 minutes
Finally, remember, nowadays the user is in control of the accuracy. You can request whatever accuracy you want, but if the user wants to preserve their privacy, they can choose not to share their precise location, and there is nothing you can do about it (other than to try to make a case for why precise location data is essential for the proper functioning of your app).
I am developing an iOS application to track user movement of the different location. I am using GPS to pull the user location[Alway from the setting location]. it works perfectly, but I am getting different location name while i am in my home.
Like in 1st bedroom you are 1503 location
and in 2nd bedroom, you are at 1702 location
how these different locations update works in background process?
It all depends of the service you are using with CoreLocation. You have here a list of the different services provided. The Standard location service (tutorial here) will be the most accurate and customizable but the less power friendly. CoreLocation often get you a location then update it to get you more and more precise location, the accuracy will also depends on the quality of your network.
You can customize the Standard location service with the following lines :
locationManager.desiredAccuracy = kCLLocationAccuracyHundredMeters
locationManager.distanceFilter = 100.0 // In meters.
The desiredAccuracy is important.
But have you ever notice this?
When you're in a building and have WiFi turned on then CoreLocation uses WiFi to also pinpoint where you are.
How does identifying a location using WiFi work?
It's roughly something like this:
Imagine you that your building has 2 sides. Left side (1502) and right side (1702).
The left side has a wifi network named LeftSideOfBuildingWiFi
The right side has a wifi network name RightSideOfBuildingWiFi
At every moment your locationServices is turned on...Apple will capture the list of WiFi networks. It will say at 1502 the LeftSideOfBuildingWiFi has a stronger signal.
So now some other person enters the house and is connected to LeftSideOfBuildingWiFi or has stronger signal with that...Apple will conclude that you're likely at 1502.
This helps preserving the battery of the iOS device. WiFi consumes far less energy than the GPS chip itself.
The same is true if you're in the downtown. Yet if you're in the middle of nowhere in the road then it doesn't apply.
The same concept works for significant location services. They use cell-towers rather than GPS chip. Say there are 4 towers near to you and each one has a different signal strength. Likely you're closer to the one which has a stronger signal...
There is a lot of error in GPS readings. They get much less accurate when indoors, and can be off by 1000+ meters. Given that much error, it is not at all surprising that the location might geocode to different addresses when you are in different parts of a house.
I want to Know what does startmonitoringsignificantlocationchanges uses to deliver location, is it GPS or Wifi/Internet? My Understanding is it uses cellular or wifi,to know if device has moved significantly but what I don't know is, at time of picking location does it use GPS alone to pick up location.
My Findings are : I travelled 30 KM in City Train but did not get any locations in background and during this journey my Wifi and Cellular data was off. So please tell if Significant fails to provide locations based on GPS only.
Building location apps in the past, I assumed that GPS was only used when startUpdatingLocation() was called. After double-checking the docs, Apple doesn't explicitly state whether significantLocationChanges CAN use GPS, but it is a power-saving option, and their docs specify that it "requires the presence of cellular hardware", which makes me pretty certain that my assumption (and yours) are correct. I'd leave this up for a bit, in case there's a hardware expert who knows for sure. The docs you want: https://developer.apple.com/reference/corelocation/cllocationmanager
Like all location functionality, it uses a combination of cell, wifi, and GPS. Use of cell is primary. The idea is to keep use of GPS to a minimum, in order to prevent drain on the battery.
You certainly cannot expect this to work with the cell turned off; indeed, if your code properly checks significantLocationChangeMonitoringAvailable with the cell off, I would intuitively expect the answer to be false.
(Also note that you will not get any events unless you have a location manager with a delegate.)
As explained in this answer "Hows does Significant Location Change work?" (and in WWDC videos from 2013-2015) Significant location change monitoring uses a technique called Cell Tower Triangulation.
You can think of it as almost the same mechanism as GPS triangulation except that the cellular hardware will be used to gauge distance from nearby cell towers instead of firing the GPS hardware to get signals from actual satellites.
In my experience I've noticed that this method gives accuracy of approx. 1000m. It does not use the GPS hardware and hence is more battery efficient. It is good for coarse location updates. See WWDC 2013 session Harnessing iOS to Create Magic in Your Apps where the presenter makes a passing reference to this technology.
I would like my iOS app to get notified in background whenever user stops (or slows down below some velocity threshold) at a place while maintaining maximum battery life.
The catch is that I don't really care for accuracy when the user is moving but I need as accurate measurement as possible when user stops or walks around the same spot.
There are many Core Location tools available:
Standard Location Service
Significant Change Location Service
Geofencing and Ranging Service
Integration with Core Motion and M7 Motion Coprocessor
Which one of them should I use? Is there a best practice for what I am attempting to do? Has anybody experience with this sort of stuff? I found this app which does exactly what I want to incorporate in my app but I'm not permitted to use their API.
I've read the documentation but my case doesn't really fit any of the categories they discuss.
Thanks in advance.
Pete.
In iOS8 there is a new technology that fits what it sounds like you are asking for. CLVisit objects are sent to your app in the background when the user arrives or departs after stopping at a location. Power consumption is very low with this feature. You enable it by calling startMonitoringVisits on a CLLocationManager object.
I am curious about why my app does not notify me sometime when I set it to be notified at same spot everyday. On iPhone 4x devices, the app uses regionMonitoring. Somedays the update is received, some days it is not.
Moreover, with significantLocationChanges also (on 3GS), the updates are not received consistently.
1) As I understand, both significantLocationChange and regionMonitoring receive updates when the device is handed off from one cell tower to the next one. Does it mean that users who live in area where the cell towers are not close by, the app will not work?
So, when there are no other parameters that can change, I am really puzzled by this behavior.
2) Does it mean that users who live in area where the cell towers are not close by, the app will not work?
3) Can I rely on regionMonitoring to notify the user consistently? What is the recommendation?
Regards. Sam.
regionMonitoring benefits from a couple other inputs to location monitoring. It triggers based on WiFi connections as well as other applications using location. Any location updates the OS receives will get run for any outstanding regions being monitored. The older significantLocationChanges is basically stuck to cell tower handoffs, and is generally less reliable in sparse cell areas.
Doesn't mean it won't work, it will just be less effective or useful.
My experience says that the regionMonitoring is the most consistent and reliable way to monitor locations without actively using GPS. It is by no means perfect, but for the majority of users, it should work with little to no issues.
I have an app that uses region monitoring and I haven't had any major complaints about accuracy at all. I made the decision to not support the 3GS and the older method for 2 reason. Few users using it, and getting smaller by the day. Secondly, it is a lot more code to support for much less accuracy and I didn't want it to detract from the overall experience, so I left it out. Hope this helps.