How to determine location source in iOS - ios

I'm getting current location,
In my app I want to know my location is from GPS or WIFI or cellular data. How do I check that ?
Is there any way to determine location source ?
Apple iOS uses
Assisted Global Positioning System (A-GPS)
Crowdsourced Wi-Fi
Cellular network search
to determine your location:
These three stages are used in descending order of priority. In other words, iOS first attempts to fix your location by using a GPS satellite link. If it is unable to acquire a satellite, iOS fails over to Wi-Fi. If you are not connected to a Wi-Fi local area network (WLAN), then iOS uses cell tower data

Apple uses all the non-GPS systems simultaneously with GPS, as part of A-GPS. To say it's falling back is not really an accurate description. Rather, while trying to get a GPS lock, it will use the other systems to get a rough idea of your location. Only if no GPS lock can be obtained, will the phone simply report what it knows from the other sources.
CoreLocation does not provide its source (or sources), but you can use some heuristics to guess.
Check the accuracy reported with location updates. A large range (e.g. 500+ meters) would indicate it's not a GPS fix.
Check which radios are available. If there's no cellular radio in the device, fixes must come from Wifi.
Check if the cellular radio is active. The device does not need service with available providers to use towers for a fix. Don't filter on that.
Those are my best guesses. If you really want this feature, you'll have to experiment.

Related

Looking for GPS device with on-board RTK that is easy to interface to from an iOS App

I've been researching a possible iOS-based app, developed in Unity, that would require a high-degree of positional accuracy (centimeters).
I expect I would need to connect, from the app, to an external GPS device using Bluetooth (or similar) and obtain NMEA sentences (or similar) containing location data.
My research has brought me to RTK, which is extremely accurate. From what I've seen already, it seems that normally GPS receivers which offer this operate themselves at normal GPS precision (2-2.5m). The correction to a high-accuracy location happens in software on a connected computer or tablet with a connection to an NTRIP server.
Assuming what I've said is correct, does anyone know of a GPS device that performs this RTK correction on the GPS device itself? Ideally I could just connect with Bluetooth or similar and get NMEA (or equivalent) data with high-accuracy location.
It may also be that I'm thinking about this incorrectly. On iOS, assuming there is an 3rd party app performing the RTK calculations, is there a standard way to obtain that high-accuracy location? Alternatively, are there GPS vendors that supply SDKs that would allow me to get to where I need to go?
Thanks very much,
Kieran
There is a recent module from U-Blox named ZED-F9P which has internal processing and is faster then RTKLib. Check this blog for performance
You can buy a board like ArduSimple's simpleRTK2B with an XBee module for WiFi/Blutooth or something similar from Sparkfun. You could also wait for the development board from U-Blox which is not yet available.

iOS Location Services visits and system Frequent Location

I noticed that Frequent Location on iPhone seems to use much less battery than an app monitoring iOS Visits (https://developer.apple.com/reference/corelocation/clvisit).
Frequent location on iPhone can be viewed on the phone via Settings -> Privacy -> Location Services -> System Services -> Frequent Locations.
I would like to know if Visit monitoring service from CLLocationManager is the same as iOS Frequent location or is it on different system used by Apple. If Apple is using the same service why it does not have any impact on the battery?
The two APIs are intended for different purposes.
CLLocationManager API
This API is designed to inform your application of location information based on requirements which are indicated by your app. You may choose some specific conditions when your app receives location data, and your app will continue to receive that data until it is no longer desired. Think for example, the Uber app would request location data when opening the app so you can schedule a ride, and would keep requesting it as your ride approaches.
Frequent Locations / CLVisit API
By contrast Frequent Locations is different in that it does not consistently report location data to your app. Instead apps can indicate they want to know if a user visited a specific location, and if the user does then iOS will inform the application. Locations tend to be somewhat rough. This would be used in the example of the StarBucks app, when you arrive near a StarBucks the app may tell you about the nearby shop with a limited time sale to encourage you to stop in. For many of these apps, the user will generally select a pre-defined list of locations which they will mark as their "favorite" locations/stores and the app will use that data to notify the user.
Battery Life
Due to the difference in how both of these APIs operate the difference in battery usage becomes apparent. With CLLocationManager we begin and continuously report either an accurate/rough location to the app. GPS is normally used here in addition to cellular triangulation and wifi hotspot location data.
But with CLVisit, we typically only notify the app a single time upon the initial visit (or departure) of a desired location. Due to this iOS doesn't need to wake the app and do any additional processing if the current location isn't roughly gotten closer or farther away from where we are interested in reporting. The device can get a rough location using cellular triangulation and wifi hotspot location data. GPS is not generally needed for this level of location detail. Since your cellular radio and wifi are usually "always on" it doesn't drain any additional power to use these two methods for location detection.
But how can it use cellular and wifi to determine where I am?
Explaining how your device derives it's location from cellular or wifi signals is beyond the scope of this question. But here is an excellent post explaining a little about how that information is derived. How does Google know where I am? - security.stackexchange.com

How to prevent or detect "Location Simulation" by Xcode on your application in production ? [Big Issue]

I guess this is a huge flaw in iOS .. like currently it's happening for PokemonGo currently the normal users are able to spoof device location to a desired one in non-jailbroken devices .. any idea or workaround to detect location simulation by Xcode ?
Using GPX location spoofing returns -1 for heading and speed - If your are looking for ways to detect spoofing, if the CLLocationManager is providing Lat,Lngs that are moving, but you're not receiving speed or heading, then the likelihood is the location is being spoofed.
How about using other sets of data to detect GPS spoofing?
Google includes it since 2007.
As an app developer, you could use the phone's internal inertia or orientation tracker data to check your GPS location's plausibility. The built-in compass may also prove useful. Using the phone's internal sensors only won't detect all cases, for example, if they are also spoofed consistently to the GPS signal, but it increases the effort one needs to invest to fool an app successfully. External sources, such as wifi-hotspot locations, would be even better but I think this is pretty much effort on the app developer's side, given that such data needs to be obtained and verified regularly by the application.
An extension on Kento's answer:
If, using accelerometer information, the phone appears to not be moving, request the user shake the device. You can keep a record of how it was shaken, and check if the previous shake was TOO similar. You would have to trial and error what the threshold would be, but I imagine it would be difficult to simulate several different shaking maneuvers.

Cannot determine Location in iPod?

I have new iPod, Open maps application in my new iPod, then select location service option in left corner and loading fraction of second, then to show "Cannot determine Location".
Then i tried to reset network settings ans reset all settings also but its no helps.
Choose new Wi-Fi network also, same thing happened.
How to fix this? Please help me
Thanks in Advance
Check this answer in apple forum. Your iPod may not be having GPS capability. This is what mentioned there,
GPS signals are separate from and completely unrelated to both the Internet and the cellular telephone network. GPS signals come directly from the GPS satellites. They provide latitude and longitude information to GPS receivers. Navigation software then takes that latitude/longitude info and converts it to land mass, roads, bridges, highways, buildings, etc.
Most navigation software stores the maps right in the iPad/iPod/iPhone but a disadvantage is that the maps must be periodically updated (perhaps once every two years). The Internet is not required to use the system but it is required to update the maps.
Some navigation software gets the maps from the Internet and requires an Internet connection to function but an advantage is that the maps are always up-to-date.
The WiFi+3G/4G iPad and the iPhone both have a GPS receiver. The WiFi-only iPad and the iPod do not and these devices require an accessory.

iOS - Assisted GPS

How would I go about figuring the position of someone inside (or outside) of a given area (such as a building) using assisted GPS with IOS app?
Is it possible to have it accurate enough withing a few feet?
Is this the right way to go about it?
Is it possible to utilize more than one wifi connection in the calculation?
Your app can use the Core Location framework to determine the device location. Core Location will use whatever hardware is at its disposal to determine the device location to the degree that you request. For example, some devices have WiFi but no GPS; others have WiFi, GPS, and cellular radios. Future devices may have other location technologies built in.
The point is that as an application programmer, you don't worry about that. Instead, you say: "give me a location that's accurate to 100 meters" or "let me know when the device has moved from the current spot by more than 10 meters" or "give me the location with the best accuracy you can manage."
Again, take a look at Apple's Core Location documentation to get a better idea of how it all works.
If you're looking to track a device with, say, 1-meter resolution inside a building, you're not likely to get that from Core Location. There's been research on triangulating position using known locations of WiFi transceivers, but nothing that's implemented in any commercial smart phone that I know of. I don't believe that iOS gives you easy access to the data you'd need to do this, so it's probably not a possibility. You could, however, go the other way: program several WiFi receivers around the building to listen for any nearby devices, use that information to triangulate the devices' positions, and then make that information available via some web service.

Resources