user location GPS coordinates when no internet - iphone

For my app i need to access the GPS latitude and longitude coordinates when there is no internet connection in device. I used CLLocation to achieve this. But when i switch off the wifi and internet in device locationmanager is showing
- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error
{
NSLog(#"didFailWithError %#", error);
}
The error i got is Error Domain=kCLErrorDomain Code=0 "the Operation could't be completed"
Once i get the proper user location how to refresh the app when the user moves from the current location?
I have downloaded the code of this tutorial http://www.vellios.com/2010/08/16/core-location-gps-tutorial/ but i got the same error.
Anyone please let me know how to achieve the GPS when offline, no internet.
Thanks

The Basics of How Location Services Determines Your Location
Apple iOS uses a three-stage algorithm in order to determine your location:
Assisted Global Positioning System (A-GPS)
Crowdsourced Wi-Fi
Cellular network search
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. If all of the above fail, then you receive an error message such as what you see in the following figure.
Assisted GPS (A-GPS) shortens the time that it typically takes for a GPS client device to acquire a connection to a satellite. For instance, my morning runs are sometimes delayed by several minutes while I wait for my Garmin GPS training watch to connect to a satellite. Imagine how painful it would be to wait several minutes for your iPhone to make a GPS connection!
Essentially, your iDevice caches periodic snapshots of satellite data in order to speed up connection time. Obviously, you will observe the snappiest GPS performance when you are outside and away from sources of interference such as tall buildings or even the interior of your vehicle.
Crowdsourced Wi-Fi means that your iDevice again caches information not only regarding the WLAN to which you are currently connected, but also regarding any other WLANs within range of your device. By storing WLAN service set identifiers (SSIDs) and media access control (MAC) address information locally, this allows iOS location services to pinpoint your location much faster through triangulation.
The idea is that if iOS detects that you are connected to your home WLAN and it already has the global positioning coordinates of that location, location services can display your location without having to work through GPS connection or Wi-Fi triangulation.
Cellular Network Search involves the notion of “triangulation” again, this time with iOS using cached information regarding your nearby cellular towers. By the way, triangulation is a geometry principle that determines the location of a point by measuring angles to it from known points at either end of a fixed baseline. For instance, iOS can approximate your location by measuring distances between your iDevice and a number of cell towers that are nearby.

Have you tried this?
[locationManager setDistanceFilter:kCLDistanceFilterNone];
[locationManager setDesiredAccuracy:kCLLocationAccuracyBest];

Related

Get the location updates using wifi or cellular tower signal

I am developing an application, where I want to get the location details using CLLocationManager class. But if I call the startlocationupdating method, then GPS is started.
I don't want to get the location details using GPS. I want to turn GPS off and get the location details using WiFi or cellular towers. How I can do this?
From the CLLocationManager doc page (https://developer.apple.com/library/mac/#documentation/CoreLocation/Reference/CLLocationManager_Class/CLLocationManager/CLLocationManager.html)
For the services you do use, you should configure any properties associated with that service accurately. The location manager object manages power aggressively by turning off hardware when it is not needed. For example, setting the desired accuracy for location events to one kilometer gives the location manager the flexibility to turn off GPS hardware and rely solely on the WiFi or cell radios. Turning off GPS hardware can lead to significant power savings.
Basically the wifi location kicks in disabling the GPS decreasing your accuracy level
Set desiredAcuracy to kCLLocationAccuracyKilometer;
You can proove that you dont have GPS by:
you never get course (degrees) (may also called heading, correct me)
you never get speed (m/s)
from your CLLLocation object, especially when moving
Further if you
dont get altitude,
its not GPS, too (also works when vehicle is stand still
the other possibility is to avoid GPS is to enable location service with "significantLocantionChange" mode. But for this i have no personal experience.

Is it possible to get user location when both cellular data and wi-fi are turned off?

I was in Scotland with a Canadian phone recently, and to avoid roaming charges I had my cellular data turned off throughout the trip. However, the pictures I took still had accurate geotags, meaning my location was still available to my camera apps (even though I couldn't actually see these locations on a map until I got home).
My question is: how would I go about retrieving location data in a situation like that, where I can't actually display a map because there is no internet connection? And, just to improve my understanding, how is the location actually being retrieved? If "cellular data" is off, is GPS still available, or can the location only be calculated using nearby wi-fi hotspots at that point? And finally, if both cellular data AND wi-fi is turned off on a device, can location still be retrieved (i.e. is GPS still active)?
Any info on the subject is welcome - all I am trying to do is handle all possible situations created by the presence or lack of location services and an internet connection in an app where I (if possible) display and store the user's location.
Thanks!
iOS devices that have actual GPS hardware in them can give accurate location data even if there is no WiFi or cellular.
Of course, most map apps require an Internet connection to display a map. But if you have a map app with local map data, then you would be able to see the map with your position even without any Internet connection.
On devices with an actual GPS, location services works just fine with no Internet. It may take a little longer to zero in on your position but it still works normally. Of course on iOS devices with no real GPS, you do need a cellular or WiFi signal to get any position data.

iOS GPS Location without carrier service neither wifi connection

specifically this question is for iPhone only, basically the question is - does iOS location service still give the geo-location (lat, long) when the device has no carrier service neither wifi connection?
Yes it will give you the location using GPS and if the GPS signal is not there it still gives you the old cached location. So in any case it will give you the location.
So far as I know, the latest models (since 3? I think?) have an actual GPS so as long as you can "see" open sky it will be getting lat/long. Whether or not the related apps are able to function (whether it can load the maps, for instance) is another matter entirely.

is internet or cell connection required for iPhone to use Skyhook to locate via wifi?

As I understand it when gps or cellular location services are unavailable the iPhone will use Skyhook to locate the device using surrounding wifi networks based on the networks locations that are stored in a Skyhook database.
If the device has no network connection, meaning it can't get at the internet at all, and it has no cell connection so no phone capabilities, can it still find the current location based on surrounding networks?
No, Skyhook is a web service. Your phone does not contain a copy of Skyhook's massive database of the geographic coordinates of every known wireless point in the world.
actually, the answer is not completely correct.
skyhook does utilize web services as part of its system, but it has client side software and a localized subset of the master data cached on the device. so while you don't need to be connected at any specific point and time, if you have been connected recently and in that local area then skyhook has loaded some data on your device and it may well be able to locate you without being connected.
see http://www.skyhookwireless.com/devices/deploymentmodels.php
that said, most apps DO need a connection to render location based content (like maps) so even if you are getting a lat/long calculated by skyhook, the app itself may not be able to render it.

iPhone Development - Assisted GPS

What's the deal with iPhone's GPS? I never get a good reading when i'm in my office building, or in my room. What really ticks it! and what doesn't? Please help me understand the assisted GPS science.
If I'm not mistaken, the gps tries to pinpoint your position using three methods:
1. Satellite
2. Mobile network
3. Wi-fi networks
So if you don't have a good reading, then probably one or more of these methods cannot be used properly in your area. For instance, satellite will not always work that well in buildings with thick walls and ceilings.
Assisted GPS means that it may have it's location from different sources than GPS satellites, for instance known wifi hotspots, or GSM masts. However these sources are less accurate the true GPS.
Claus
For the actual GPS in your iphone to get a good position, it has to be in direct sight of the GPS satellites. It cannot do that inside a building. So if you are inside you are not going to get the best position from the iphone. It can give you a position using other methods such as the cell phone network and public wi-fi networks, but these positions aren't as accurate as the real GPS position.
Here is an article that explains the GPS system:
http://en.wikipedia.org/wiki/Gps
Depends on whose definition of Assisted GPS.
True 'assisted GPS' means the GPS receiver uses a known initial position, from the cell tower location, to bootstrap the GPS position calculations. If you know where you are it's much quicker for the position solution to lock to the signal - that's why GPS take so long to find first fix compared to updating.
Some APIs use assisted GPS as shorthand for alternate location services where if GPS is not available, is disabled, or would use too much battery power it will supply a lower grade position based on cell tower triangulation or other methods.
There are many answers I found in WWDC 2010 – Session 115 - Using Core Location in iOS 4.
Very advised.