Would it be possible to take the ip address of a wireless router that an android phone would connect to and determine in the app the relative location of the ip?
There's lots of online APIs available to determine a location based on an IP address, e.g. here, here, or here.
You could make a request to one of those services, passing in the appropriate "Internet-facing" IP address (which is different than the internal IP address that usually starts with 192.168., see here for an explanation).
If your goal is to get the user's location, use Android location services. if your app has requested it and the user hasn't disabled wireless location services, it will use WiFi as well cellular networks. It's already packaged right into the SDK and convenient to use.
It might not be a nice thing to go behind the user's back with other methods and get their location without requesting a permission to do so. If you need their location, you might as well go through the approved mechanism.
Related
I am developing an application that mocks the location of the user while other apps try to access it. I am using a rooted Samsung Galaxy S3 with Cyanogenmod 12. So far, the mock locations have shown to work against the Yelp. However, whenever I open the default browser app and google "near me" or "where am I," the results know my true location. Why/how does the browser know where I am and that I am not in the spoofed location?
The browser likely determined the location based On IP Address as opposed to GPS.
Per this wiki page:
An IP address serves two principal functions: host or network interface identification and location addressing.
Determining location using GPS uses the satellite system to determine the location. How GPS works is here. However, in the case of IP Address, the location is determined using the IP Addressing system which was designed in a way to be able to determine location. The IANA (an organization which oversees allocation of IP Addresses) allocates IP Address to regional internet registries as described here. The regional internet registries then allocate different addresses to ISPs which then allocate to customers.
To sum up, the "numbers" an IP address consists of helps determine the location of the user.
I used an android smartphone in the following situation:
without SIM-Card
connected to a WLAN
located in an indoor environment (GPS does not work)
located somewhere other than the address probabely set in google account
for positioning in Google-Maps App. The result was roughly correct (about 15 meters error).
There is no GPS signals to get position.
Thre is no SIM-Card. So using Cell ID is impossible.
It means the only resource from which my position is achieved is internet. Could anybody explain to me (while I couldn't find anything in internet) how this is possible?
Google gathers information on the SSID of WiFi hotspots. They drive around with cars gathering street views for their maps and other information like the location of WiFi hotspotes. They store it in a data base somewhere and when you ask for your location it will find out the SSIDs of every WiFi hotspote around you and then give a rough estimate based on signal strength and other information.
Google might use people's cell phones to gather WiFi SSID information as well I am not really sure about that though. I think this because there are setting in most android phones asking to help Google for accuracy using WiFi...
Other sites use public ISP information obtained by IP address but this is not as reliable as it gives the location of your ISP (Internet Service Provider).
Here is a site where many people are discussing this topic.
Here is a site that teaches how Google finds location data through SSID
Here is a site that teaches how geolocation software finds ISP location
Google, apart from other ways, uses SSID of the nearby networks to get your position. AFAIR there was a big concern about Google Street View Cars scanning for wifi networks, recording SSIDs for location purposes. If that SSID is not registered, they probably use some kind of IP location service, based on network provider ip address pool.
See Google maps Android API getting wifi location for more details about getting that information from Android.
Android may use wifi and sensors in order to get your position. The more wifi routers around - the more accurate your position.
I have an Android application that accesses the device's location and then queries the WiFi parameters. Everything typically runs smoothly.
If I turn off the Location permission for the app (as I can do in Android 6) I no longer get the device's location (as is expected). However, I also get a modified WiFiInfo object when I try to query the WiFi parameters. In particular:
getScanResults() normally lists all of the networks available, but with Location turned off it only contains the network the device is connected to.
If I look at the capabilities of the network that is found, the string is empty. Normally it contains information such as the wireless encryption information.
Has anyone else seen this? I've verified it using the same code with the Location permission turned on/off on 2 different devices. Any idea on what's happening?
Update: On further review, I was wrong when I said that getScanResults() returns information about the AP that the device us connected to. It in fact returns an empty list. This would support the idea that Google doesn't want us to have any information about the local APs if Location permission is denied.
WiFi-based location is basically a lookup of WiFi access point information in a giant database of known APs and locations to discover where a device is. This is what services such as Google, SkyHook, and Apple use when you enable WiFi or network location.
I suspect Google is trying to prevent an application from accessing information from which location can be derived when location is disabled. They have previously blocked access to Google Play location services when location is disabled, but this does not prevent a device from doing a scan, collecting the same data that would be sent to Google, and sending this data to a different service to discover location.
I am trying to get the location information of Android phones connected to a particular wifi access point/hotspot which is another Android device. I know how to obtain location information for a particular Android device using the Location API as well as the signal strength information of the access points in vicinity. Actually I am trying to send the location information of all the nodes connected to the hotspot. For that maybe I need to open different sockets. After that based on that information I have make some decisions. Can anyone give me a good approach to solve this.
You can't get location direction from WiFi hotspot (actually WiFi spot itself doesn't know where it's located).
http://en.wikipedia.org/wiki/Skyhook_Wireless
there are databases which contains mapping between WiFi hotspot MAC address and locations. So, your application should get info about WiFi hotspot and after go to one of this databases.
To know more about that u can refer this one http://developer.android.com/guide/topics/location/strategies.html
Wanted to know how Lat/Long info will be retrieved for specific location where my mobile device is connected to one of the public WiFi hotspot AP. So, my program gets the data and pass on to find location info to originate E911 calls or sending location info for any calls made?
if this possible, let us know how this can be done? are there any specific Android APIs to do so? Please provide the details if possible.
You can't get location direction from WiFi hotspot (actually WiFi spot itself doesn't know where it's located).
However, there are databases which contains mapping between WiFi hotspot MAC address and locations. So, your application should get info about WiFi hotspot and after go to one of this databases.
As example, check this out:
http://en.wikipedia.org/wiki/Skyhook_Wireless
Location can be retrieved using various ways in android from GPS or from your internet access ( whether its wifi or 3G) the great thing is that in android the last location that was retrieved from any application on the device will be saved and you can actually compare your currently retrieved location with the previous to see if its better or more accurate.
Here is a link that can let you understand better how location works with android.