Im working on a application for which I need to decide in which country the user is. Which is the most accurate way to do this?
Should I use GPS or IP-adress?
What would be the pros/cons with each method?
I would use Apple's location services, which use several technologies (cell towers, WiFi hotspots, GPS, etc.) to determine their location. You can then find the country quite easily with a lookup of the GPS coordinates. I think this would be more accurate than by-IP lookups.
Its probably easier if you go via ip address and use a geo ip lookup service.
For GPS the GPS unit needs to be turned on. I guess lots of people disable it for energy saving. If you just turn on GPS for your check the user needs to get a gps fix first which can be time consuming as well.
Related
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.
In my app, I am trying to figure out the location of my app user using WiFi (not GPS because my main area is inside the buildings), can any one please tell me how can I get user location using hotspot of WiFi.
Any basic guide or example is good .
Thanks in advance.
egards
Use Core Location. The Core Location framework hides the actual device capability from you (more or less) and (depending on the options you set) give you a best estimate for latitude and longitude. I've used the exact same app on an iPhone and iPod touch and have gotten pretty good results with the touch. It won't be as accurate, but it's good enough for most applications.
Check out the Core Location documentation and the "LocateMe" sample code from the developer site: https://developer.apple.com/library/ios/#samplecode/LocateMe/Introduction/Intro.html
Unless you mean to figure out the location of your user in a specific building with known Wi-Fi spots, you'll have to resort to using a IP address geolocation database. There are services, such as that provided by MaxMind, that have a database which you subscribe to for updates. The database maps IP addresses to locations.
This will only get you approximations, so your best bet is to use GPS primarily but IP address as a backup.
I would like to locate the iPhone in a building to build an application with similar features as the iPhone app of the American Museum of Natural History. There is no good GPS reception as there are also rooms in the cellar I would like to cover.
What can save me is that there is good wifi coverage in the whole area, so my idea was to triangulate the position based on the wifi base stations in range, whose positions are known. However I found no public API to find out which base stations are in range.
Questions
Do you have an idea how the app mentioned above manages to get the correct location indoors?
Could one add the wifi base stations manually to Apple's database and use the usual CoreLocation?
Do you have other ideas how to implement it?
Any help is very much appreciated!
Boundary conditions
The indoor navigation is only used during an event to guide guests new to the building, so no complex infrastructure should be installed.
There are approximately 14-18 rooms to be covered. They are in different parts of the building, so wiring everything up would be very costly.
The preferred solution would not require a server backend of any kind and would work with a list of wifi access points and their corresponding locations.
I wouldn't know about 1 and 2. But if you would implement such a thing, turn it around to save a lot of trouble: create your own free-of-charge wifi network, and let the network determine the location, either based on triangulation, or just based on the currently associated access point. Make their signal weak so you have one audible access point per room. Let the app ask a server in what room he appears to be. This will also work for any other mobile/pda/laptop.
As for other ideas: You could use bluetooth to do somewhat the same as you're planning for wifi. You can't do everything with bluetooth, but listing devices seems to be one possibility. So just put a bluetooth device in every room. Bluetooth range is limited by definition.
Another one would be to use the microphone in conjunction with a high pitched sound which identifies the room, but that would cause trouble with dogs (for blind people), attract bats, and repel mice at the same time. Better focus on an RF based solution ;-)
You can also check out Navizon's indoor positioning system:
http://www.navizon.com/product-navizon-indoor-triangulation-system
Their system is able to locate iPhones by using the WiFi signals transmitted by the device and doesn't require an app to run on the phone to locate it. It can locate any other WiFi enabled device for that matter.
Check out wirelesswerx.com They seem to be doing indoor location using Bluetooth and it looks like they can do permanent install or temporary for events.
More specifically, does CL require the user to have a data connection? Or is it possible to just use the phones service connection?
Thanks!
It actually uses several mechanisms.
GPS
Cell Tower Triangulation
Wifi Hotspot cataloging
Randomly assuming you are in Cupertino
There are tradeoffs based on speed, precision, and available hardware. A first Gen iPad will only have the 3 option available while the iPhone simulator makes use of the last mechanism.
You can observe the difference in these systems in the map application where it initially guesses based on the cell tower, then refines the guess via GPS.
Only options #3 requires a data connection.
And for the humor impaired including #4 was not totally serious although it is functionally correct. (I think they simulate the GPS reporting that location rather than just hard coding it, but I haven't checked.)
You can set the phone into airplane mode and still get a location :)
It will be forced to use GPS to get it so it might take longer to get though.
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.