location with OFF internet connection - android

I am trying to get current exact user's location coordinates, and update the location when the user moving without internet connection in android.
which says "Common sources of location information include Global Positioning System (GPS) using GPS-PROVIDER
and location inferred from network signals such as IP address, RFID, WiFi and Bluetooth MAC addresses, and GSM/CDMA cell IDs using 'NETWORK-PROVIDER'.
It is well known that the GPS doesn't need internet connection to get the location.
So the question is what about the network provider??
Can I use network provider when internet connection is OFF ? if not ? why !!
I think it can work without internet because it Depends on GSM/CDMA cells so it will get the location by the Signals connect with cell tower, I hope I'm thinking right.
By the way I have not used the google location Apis (client & server) because I read more than once that it needs an Internet connection,
that's why I'm using now Android APIs locationManager().

As far as I know, google's location API's makes the most out of the network connection when it comes to location.
Either way, from Android developers: "The Google Play services location APIs are preferred over the Android framework location APIs (android.location) as a way of adding location awareness to your app. If you are currently using the Android framework location APIs, you are strongly encouraged to switch to the Google Play services location APIs as soon as possible."
Follow this link for more info:
https://developer.android.com/training/location/index.html

Related

Disabling Location permission on Android 6 seems to affect WiFi parameter queries

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.

Getting location null with fused location provider getLastLocation

I am using googleApiClient with LocationServices api to get the location.
I am able to get last location if In phone settings wifi & mobile network location is checked.
But If I unchecked the wifi & mobile network location. It does not provide any location. while GPS Settings in checked in both cases.
My question :- Google's new api can get location from gps or not. ?
Google's new api can get location from gps or not. ?
may be yes.
But as per Google
The Google API Client provides a common entry point to all the Google Play services and manages the network connection between the user's device and each Google service.
We must have to provide the network access either wifi or mobile-data for getting the actual location's co-ordinate.

How can we detect location without GPS or WiFi?

We have an interesting use case where the intended device does not have GPS embedded in it. Nor will it be connected to any cell towers.
The only connection the device has to the outside world is through the web. But there is a high probability that the network location is in different city showing the wrong address...for example user is in CA but the network being accessed is located in MI (thus showing the user's location in MI).
Does the Android SDK contain an API that can serve as a workaround to this scenario?
IP Geolocation should work, unless when you say "network being accessed" you mean that the Android device creates a VPN tunnel to MI.
The Google Maps Geolocation API will also work off of wifi towers that the device can detect, so local wifi signals may be able to pinpoint the device location.

Google maps Android API getting wifi location

So I am working on this app that will get the location of a wifi hotspot by just detecting it using the sensor wifi of the phone (The phone is not actually connecting to the hotspot wifi, it just detect).
I was doing some preliminary research before start developing the app, and it seems that the Google Geolocation API will do the work for me. However, it is not free (at least what I understood after reading through the API). I had checked other apps that detects wifi hotspot, and I am just wondering if those apps have their own database with all the wifi hotspot information (SSID, location coordinates, etc) so when the wifi sensor detects a wifi hotspot, it will lookup the database and get the information such as location.
Also, I was mentioned by a colleague that Google Maps also stores wifi info. Is is true? Cause I couldn't find any info about that.
Android has multiple LocationProviders, including:
LocationManager.GPS_PROVIDER : get position using GPS
LocationManager.NETWORK_PROVIDER : get position using Wifi, cell network, etc.
LocationManager.PASSIVE_PROVIDER: get position using data provided by already running providers. This allows several apps to share geolocation information)
You don't have to pay anything to use NETWORK_PROVIDER
Some providers might not be present on all devices, depending on phone model and android version.
Providers have different characteristics: NETWORK is fast but not always precise enough, GPS is precise but slow and battery intensive, etc. The best strategy is to request location from several providers, and cancel pending request as soon as you get a location that is good enough depending on your criteria (precision, response time, etc.)
I found this article by Reto Meier quite useful to wrap my head around geolocation on Android

Get location of wifi ip in android

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.

Categories

Resources