I am trying to get the user's current location using phonegap Geolocation api, which says "Common sources of location information include Global Positioning System (GPS) and location inferred from network signals such as IP address, RFID, WiFi and Bluetooth MAC addresses, and GSM/CDMA cell IDs". I am able to properly get the location when internet is ON (irrespective of the state of GPS).
Is there a way to get the location using triangulation when the internet is OFF or not accessible? (GPS might be ON or OFF)
A BIG "NO"! This is like cutting down hands and asking if I could clap now? GPS and NETWORK location providers are the only way to receive user device location.
For GPS location - you need GPS sensors to be ON.
And for NETWORK location you need to have internet connection ON, because in this case the location is calculated on the basis of Cell-Tower/Wifi-spot ID which is then sent to google servers (via internet) to fetch the location details of the respective Cell Tower or wifi spot. Google's location server have its own location approximation algorithms on the basis of which it tells your location.
So, there could be no way you could receive a location when both GPS and INTERNET are OFF.
Note: You can still get the last received location from any of these providers by using LocationManager's getLastKnownLocation() even when the providers are OFF. But this locations are usually outdated ones and are barely of any use.
{ enableHighAccuracy: true }
Enabling that option will allow the Android device to get the location even with the WIFI option disabled.
Related
I'm trying to develop an android application which can acquire GPS location without using Internet and even network location using SIM. Actually, SIM will be inserted in phone and i know that location upto 500m accurate can be acquired through it. But in case of no SIM signals in the area, is it possible to acquire location?
Yes, you can use GPS without any external data connection because signals from the GPS satellites are receive-only.
On a device, the permission setting is known as device-only location mode:
Device only
This mode uses only GPS. It doesn’t use Google's Location service to provide location information. It can estimate your device's location slower and use more battery.
Yes You can get the coordinates but for using map services you need internet.The only thing is your GPS will take a bit longer to lock your location on a cold start, and it might not be quite as accurate.
It's a aGPS (Assisted GPS), and get's part of the location information from the data network (If available) on cold start, then fine-tunes the location further than what a GPS alone can do.
Shouldn't be an issue however, really. Just turn your GPS on a little sooner (Like while getting ready to leave, not waiting until you are in your car).
Yes. If you use the Location Manager, set the Provider to LocationManager.GPS_PROVIDER. If you use Google Play Services, it should work automatically.
Android is constantly changing. Currently, the Fused Location API is being used for location detection. But in my experience, without a Data connection, the GPS signal is not being found anymore.
How do I use the device's GPS only whenever there is no internet available?
Fused location provider uses a hybrid way to find gps using a variety of sensors, WIFI/data and the actual GPS chipset.
It will find the location COARSE/FINE accuracy is up to your case. It will just take a while longer than with the internet connection. If indoors or in an isolated area, it may very well take over a minute or two. Sometimes if the data signals just don't reach the device, yes it can fail.
It does work without WIFI or DATA in most cases.
I see that LocationManager.NETWORK_PROVIDER.getLastKnownLocation() returns the last location, but how is the location updated? If the GPS is disabled, will it entirely rely on BSSIDs detected by WiFi? What if the WiFi is also disabled? Does it take mobile service tower data into account?
Yes, the location service has basically three levels: GPS, WiFi, Cell tower.
GPS is used with the GPS_PROVIDER, and WiFi and cell tower go both into the NETWORK_PROVIDER bucket.
To quote the NETWORK_PROVIDER description:
This provider determines location based on availability of cell tower and WiFi access points. Results are retrieved by means of a network lookup.
I want to fetch the location using google play services LocationServices.FusedLocationApi.getLastLocation(mGoogleApiClient); when GPS/Wifi is turned off. Reading the articles/blogs regarding FusedLocationApi, its mentioned that this API will provide the accurate location using any of GPS/Wifi or Cellular network. I am confused that if cellar network can provide the location then FusedLocationApi should return the location if Gps/Wifi is disabled but its returning null. Can anyone please let me help/guide to fetch offline location using cellular network.
Regards
You cannot get location using the cellular network through the standard API when GPS and WiFi location are disabled.
The device must have location enabled in order for an application to retrieve location. This is a basic permissions issue for the end user; if the end user requests that no location be available, then no location is available.
When retrieving location, there are two sources of information:
GPS: This uses satellites in space to locate the device. GPS provides the most accurate location, but is slow, especially if you do not have a data connection. On the device this is the "device only" mode.
Network: This uses WiFi and/or the cellular network. There is not a way to choose WiFi and cellular location separately. When you get a location update, the horizontal accuracy is a strong indicator of whether WiFi or the cellular network was used. WiFi accuracy should be in 10's of meters, while cellular will probably be 100's of meters. If you are in an area without WiFi coverage but with cellular coverage, then the network source will still provide location updates.
You can also use both these sources. This is the "high accuracy" location mode.
If you turn both of these off (disable location), then you will not get any location.
I'm using network provider for location updates. Do I need to to have internet on my cell?
Here is my code
LocationMngr = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
LocationMngr.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, inteval, 0, this);
I'm getting confused of seeing other's Answer. Then I searched a lot and get some idea about that. While searching only, I have learnt about new concept of A-GPS. I would like to share those things with you.
There are three location providers.
1. GPS Provider
2. Network Provider (AGPS, CellID, WiFi MACID)
3. Passive Provider.
Note: I refer this from this site. As you asked question related to network provider, I will share regarding to that.
Network provider, name itself says that it needs network connection. Refer this article. It need network or WIFI connection to proceed.
A-GPS
GPS on cell phones is a bit more murky. In general, it won't cost you anything to turn on the GPS in your cell phone, but when you get a location it usually involves the cell phone company in order to get it quickly with little signal, as well as get a location when the satellites aren't visible (since the gov't requires a fix even if the satellites aren't visible for emergency 911 purposes). It uses up some cellular bandwidth. This also means that for phones without a regular GPS receiver, you cannot use the GPS at all if you don't have cell phone service.
For this reason most cell phone companies have the GPS in the phone turned off except for emergency calls and for services they sell you (such as directions).
This particular kind of GPS is called Assisted GPS (AGPS).
Note: Even if phone supports it, and network does not then this does not work
No need for Internet for retrieving location (GPS or Network provider). Using Internet can speed up the process and giving you more accurate locations (when dealing with Network provider).
No, the GPS sensors are independent of connections to the internet, so you don't need to worry about internet connectivity if you just want to get your location via GPS. I have a Nexus 10 which has a GPS sensor, and it works just fine when I'm roaming without internet connectivitiy.
no you don't need internet conection.but in some roms it may be some errors in conection.
in gps module you don't need internet but some ways you can use wifi for more performance in.such as google navigation services.