I am a beginner in android developing and I am working on a project to create an app to locate cell phones without using GPS.Can anybody help me with how to get the RSSI for GSM and the distance if possible.Any code available for this purpose would be appreciated really.
I would also like to know, what other information can we get from the SIM card.
For SIM information including RSSI, you need to look at the Android Telephony and related APIs.
You can't get the distance from the base station though. You can get the Cell Id, which gives you a rough location if matched up to a database. Cell Id information is proprietary though, and publically available databases aren't always that accurate. Or you could use three Cell Ids + RSSIs to do a rough triangulation calculation yourself. The disadvantages with that are that many devices won't return cell info for the surrounding cells; you still need access to a reliable database of cell locations; ideally you should also include known WiFi hotspots; it's a lot of work to implement something that Android has already done.
Android handles location via its own location and location services APIs. LocationManager lets you choose the desired technology, e.g.NETWORK_PROVIDER or GPS_PROVIDER. So you could just choose not to use GPS, and let Android give you the best available result from the network.
Related
Is it possible to get location of the caller when get a call? If so provide some links to achieve it. Thanks in advance..
Edit: OR else how to get at-least approximate location or lastly State name of the incoming number.
No. That data isn't carried over the phone call in the metadata, and there's no data connection in a phone call. Nor does it make sense for it to be sent- that['s a security nightmare. How would you like it if your worst enemy could find out where you are at any time just by calling you? Or a pedo could find a child's location by calling their phone? Or a rapist a woman's location by calling her? It's a bad idea. If you want to share your location with someone there's a variety of apps that do that, and just about all of them allow you to restrict that knowledge so you have some security. Use them instead.
Getting the exact location of a caller in mobile networks is theoretically impossible, due to the architecture of mobile networks.
Briefly speaking, Mobile networks divide land areas into "Hives", which determines a closed ploygon. The shape of the polygon is normally a hexagon which is adjacent to other hexagons. These hexagons are covered by BTS towers, which are responsible for responding to call requests, routing and call hand-over.
Some but not all providers enable their BTS to report their GPS coordinates and the database of all these coordinates is some kind of confidential data.
Again some but not all providers, make their databse of BTS towers available , which depends on the host country regulations and the provider company policies.
However there are databases on the web, which gather this coordinates of different providers but since the data is not gathered or distributed in an online and timely fashion, there may be complications, let alone the web service you need to use for querying which normally is not provided.
But since I assume you're in India, you may find this website useful.
EDIT
After googling , I found these websites that provide Cell-ID databses.
https://unwiredlabs.com/2
http://location-api.com/
http://www.opencellid.org/
https://wigle.net/
http://cellspotting.com/webpages/cellspotting.html
http://www.cellmapper.net/
http://www.opencelldb.net/
I want to know how Geo Location is found through a Network provider without GPS in an Android application?
How exactly is triangulation of cell towers implemented in code and how is latitude and longitude of the cell towers is obtained to get the accurate location through NETWORK_PROVIDER?
Where exactly can I find the source code which implements this functionality? (Android is a huge codebase and I don't know my way around it).
I cannot use the LocationManager or LocationProvider or any class or objects directly as I want to mimic this functionality in hardware so I just want to convert the source code to C with same functionality.
Sorry to say, but Google has not open-sourced this part of the code.
You can see LocationManagerService - it talks to a remote service using a LocationProviderProxy. The implementation is in a NetworkLocation.apk in pre KitKat distributions and shipped by Google on every Android phone. (In KitKat it is in Google Play)
Relevant package name for KitKat :
private static final String NETWORK_LOCATION_SERVICE_ACTION =
"com.android.location.service.v3.NetworkLocationProvider";
Google uses WiFi positioning data + Cell ID information for triangulation.
I think you want to know how cell ID position occurs - there are many positioning protocols that have evolved from 2G to WCDMA to LTE. I think you will find this Spirent white paper interesting - An overview of Hybrid Location technologies
I'm looking for a way to know the country-level location.
How to do it on a phone, or devices that have cellular network connectivity or GPS is clear. But what about devices that don't have that?
I know from Google Analytics that Google has that kind of location information,
How?
How can I get that information as well? Maybe from the play-store locale or something?
By "Tablets" I mean devices that have no GPS and no GSM / cellular network connection.
10x
Use the WiFi aproximated location. It checks your IP adress and tries to locate it geographically.
please see this or this.
a quick summary of the WiFi location method form one of the posted links:
How it works: Unless you opt out, your phone is periodically sending anonymous data to Google with, among other things, your last known location and any Wi-Fi network you were connected to at the time. The accumulated data builds on a database begun by traveling Google Streetview cars that recorded Wi-Fi networks available along their routes (the cars no longer do this).
When using this method, your application will ask for the COARSE LOCATION permission on installation.
Since there's no clear indication (at least none that I've found) whether or not Google estimates location based on IP as a last resort, my 'getCountry' logic would be as follows:
Location location = LocationClient.getLastLocation()
If (location == null) location = getLocationByIp()
where getLocationByIP() will use a publicly available, RESTful free web service such as http://freegeoip.net/
Open to suggestions here. If line 2 is redundant I will be happy to drop it.
Cheers
(Y)
I need a way to determine which cellular network band my phone is currently on, and which tower it is connected to.
How would I go about doing this? I know there is a "Service Mode" you can enter with the command *#0011# --> however this does not work on my phone.
If there is a way to create an application where I can get this information, that would be ideal. I believe I would need to access the internal telephony classes of the android OS - which can be accessed via reflection.
Thanks
Take a look at these:
http://developer.android.com/reference/android/telephony/gsm/GsmCellLocation.html
http://developer.android.com/reference/android/telephony/TelephonyManager.html
You can get the CellID with appropriate methods within these classes. The CellID is a unique number for each cell (or each sector) so that identifies the tower. But relating that number with a specific tower (that is, its location) is harder, as that usually is not public information.
I'm not sure if you can get the frequency band, but if the "cell info" methods mentioned in the above links include channel numbers (ARFCN), you can deduce the band from those numbers.
We know there are two positioning mode in Android: GPS and network. If we use network, then Android can use WIFI or 2G/3G cell tower to position. Without GPS, we can simply use LocationManager.NETWORK_PROVIDER to get the location data. But how can we know the mode is WIFI or 2G/3G cell tower exactly? Android doesn't provide separate providers for WIFI and cell tower.
I have thought a method. But I am not sure whether it is correct. Please review and give comments:
Check whether I can get a WIFI hotspot list. If nothing in the list, cell tower must be used.
If there are some WIFI hotspots, and the accuracy is high (<=100m), then WIFI is probably used. If the accuracy is low, is still cell tower used?
In my understanding, the accuracy of WIFI positioning is relatively high. But what's the normal range of the accuracy for it? Another question, does Android use WIFI and cell tower at the same time? If it does, then in my application, I can think it use WIFI, not cell tower.
Thanks!
Actually, there is a way to do this. It is not just documented well and thus might also change without notice.
You can get the used location estimation method via the network location provider location update extra data.
Bundle extras = location.getExtras();
if (extras.containsKey("networkLocationType")) {
String type = extras.getString("networkLocationType");
if (type .equals("cell")) {
// Cell (2G/3G/LTE) is used.
} else if (type .equals("wifi")) {
// Wi-Fi is used.
}
}
This is correct, Android does not explicitely give a way to determine how the network location is computed. The principle of the network provider is to collect all the relevant data on the device, and then send it all to the Google servers, where your location is computed and sent back to you. I am not sure, but the network location might also use the accelerometer/gyro/compass data to improve the accuracy of the location, especially when you compute your location continuously.
So I believe it can use simultaneously cell tower and Wifi info.
Your accuracy method should work in most cases, but is not 100% reliable.
Another possibility is to turn the wifi off, compute a first location fix, then turn it on again and give it another try. by comparing the two locations and their accuracy estimates, you can probably guess the influence of wifi on the location engine at your current location.
Out of curiosity, why do you need this for?