is it possible to get location via a cellular network if the device doesnt have a data plan?
or does it need a data plan to be able to get location via a cellular network?
is a data plan needed to get location via a cellular network?
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It only takes a minute to sign up.
Sign up to join this communityis it possible to get location via a cellular network if the device doesnt have a data plan?
or does it need a data plan to be able to get location via a cellular network?
is a data plan needed to get location via a cellular network?
Yes, that is possible without a data connection by e.g. using UnifiedNLP and a corresponding location provider. I e.g. use the LocalGsmNlpBackend, which downloads a selection of the OpenCellId database (for the area I need) to the device for local usage. That database contains the positions of cell towers. As you are booked into at least one of those, your coarse location can be estimated. Add another location provider which is e.g. WiFi based for more accuracy if you wish. Apart from downloading the data (preferably while connected to your home WiFi), this works completely without a data connection.
Make sure you pick the correct UnifiedNLP package, depending on whether your device has the Google framework installed (stock ROM usually has this, or if you use a custom ROM but have GApps installed) or use a custom ROM without GApps.
For a more detailed description, please see my article Android without Google: microG, which discusses the variant on a device without Google framework.
On Android, apps can be granted location via two types of permissions: android.permission.ACCESS_COARSE_LOCATION
and/or android.permission.ACCESS_FINE_LOCATION
from https://developers.google.com/maps/documentation/android-sdk/location#location_permissions
android.permission.ACCESS_COARSE_LOCATION – Allows the API to use WiFi or mobile cell data (or both) to determine the device's location. The API returns the location with an accuracy approximately equivalent to a city block.
android.permission.ACCESS_FINE_LOCATION – Allows the API to determine as precise a location as possible from the available location providers, including the Global Positioning System (GPS) as well as WiFi and mobile cell data.
So if the app is giving you the weather, all the app needs ACCESS_COARSE_LOCATION
which will give the user location good for a 10s of meters radius which is good enough to know where that person is for weather conditions. This level of accuracy can be done with WiFi or data via cellular towers.
If the app is a ride share app, then ACCESS_FINE_LOCATION
is needed as will give the user location to a few meters. This will use GPS to get the location of the user.
So now we get to your question:
is it possible to get location via a cellular network if the device doesnt have a data plan?
If the mobile device has no data plan via cellular network AND no data via WiFI then apps don't get COARSE_LOCATION
without a distinct Location Provider
(see @Izzy answer).
Note that at least in the United States carriers are required to support E911 which in an emergency is supposed to be able to provide location of the phone to emergency authorities.
If you are disconnected from any network Cellular, disconnected from WiFi and not using a specialized Location Provider
then GPS will be able to get your location coordinates. Calculating those coordinates requires data which is provided in the signal from the satellites, but due to the low bandwidth will take many minutes. Coordinates alone doesn't make an app as any mapping app would need to pre-cache your map data (streets, landmarks, rivers, etc.) from when you did have data to when you don't have a data connection. Having a data connection will speed up the calculation for FINE_LOCATION
.
There is NO generic casual user
and I say this as an app developer. Better to describe what you wish to do, also known as a user story or use case and you'll get a more informed answer. If you are doing Navigation you'll need FINE_LOCATION
with the power usage and GPS cutouts in urban environments.
– Morrison Chang
Jul 24 '18 at 7:34
There are two basic ways of geolocating a device:
Look for local radio transmitter IDs, and look these up in a database. The radio technology can be cellular, WiFi, or Bluetooth; the principle is the same.
If you do not carry the database on the device (the normal case), then you need a data connection of some sort. The data connection does not need to use the same set of transmitters used for the location lookup; you can look WiFi IDs using a cellular data connection, or you can lookup cellular IDs on a WiFi data connection.
If you carry the database on the device, you do not need a data connection. Lookup the ID on your local database, as in Izzy's answer.