How to detect available carrier networks? - android

Is there any way in Android to detect all available carrier networks in the area. I tried to search it from connectivity manager and it seems it only returns active network info. I also tried the telephony manager and it only returns signals and neighbor info of the active carrier (e.g. other signals of same carrier). I would like to create an app that will scan for available cell networks in every country -- like in Settings -- to choose my network when roaming.

as far as i know that is not possible, because you can only get the cell info of your SIM carrier, but we have a new method on TelephonyManager called getAllCellInfo ().
The problem is that method its only available on API Level 17, only available on devices with Jelly Bean (4.2).
Check this link for more information.

Even the getAllCellInfo function will never report "all networks" that are in the air at your location, simply because the phone will only listen to / measure on the frequencies / networks that the current serving cell tells it to measure on. Normally this means that it will only measure (and be able to report cells) from the same network as the phone is currently using.
If the phone has lost coverage from its "home PLMN" (home or selected network) it will however periodically do measurements in other frequencies to try to get back to it's "favourite network".
To be able to get lists of all present networks in your area you need to have another kind of device for example a "scanner", which never locks on to any cell, but continuously scans many frequencies to find cells from any network and any radio access technology (GSM/WCDMA LTE for example) within these frequencies.
Or continuously press the "select network" function...
/ Kenneth

Related

Query neighboring cells' cell-ids in android for 4G

I am interested in using mobile phones for conducting network field tests - i.e. collecting information about signal strength as well as other related values for a mobile network, in particular for 4G-LTE-networks.
There are a couple of applications already out there which can do this, e.g. GNet-Track (https://play.google.com/store/apps/details?id=com.gyokovsolutions.gnettracklite)
These apps are using the TelephonyManager's getAllCellInfo() to retrieve information for the serving cell (the cell to which the mobile is connected to) as well as for neighboring cells (cells that the mobile can detect but is not connected to).
Depending on the mobile phone (e.g. http://www.gyokovsolutions.com/survey/surveyresults.php) as well as on the connection technology (3G, 4G, etc.), more or less information is retrieved with getAllCellInfo(). E.g. some phones do not report information about neighboring cells at all, while other might only report the strength of the signal, etc.
From a CellInfo object, one can retrieve the identity of the cell via getCellIdentity() (to be precise, it's getCellIdentityLte(), getCellIdentityGsm() etc. in dependence of the used network technology).
The CellIdentityLte object contains (or at least should contain) the values mcc, mnc and ci (cell-identity), which can be used to identify a cell globally (computing the ecgi).
Now, the problem I am facing is that every phone that I have encountered so far (e.g. OnePlus-Three, Samsung S7) is unable to report the cell-identity of the neighboring cells (instead UNAVAILABLE (=2147483647) is returned). Other values are available, e.g. the field PCI of the LTECellIdendity of the neighboring cells were available.
My question is: Has anyone encountered mobile phones which are able to report the cell-identity of neighboring cells in a 4G-network?
This seems to be a recurring problem (the linked discussions concern other technologies, but face the same problem):
https://github.com/mozilla/ichnaea/issues/17
cellID and LAC / PSC for 3G neighboring cells in Android

Android: Controlling Wifi Range Potency

I am developing an android application and I would like to be able to control the range potency of my smartphone's wifi.
For example, suppose that I want to use the Wifi direct API, but I it shows me people that are in a range of 10 meters from me. Although this is very good, I just want to connect with people that are in a range of 3 meters from me. In this case my idea was to limit the potency of my smatphone's wifi, in order to only "see" the devices that are very near me.
My question in this case is: Is there anyway to limit/control the potency of the wifi device of my smartphone ?
The WifiManager exposes the public WifiManager.WifiLock createWifiLock (int lockType, String tag) method to allow for the application to claim a lock on the Wi-Fi in a certain mode, however, this is no mode that allow for the power to be decreased. So the answer to your question is no.

RSSI signal from cellular network to be obtained in android application

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.

ANDROID: Query Network Band frequency information

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.

WifiManager.getScanResults() - clarifications (automatic scans, sleep etc)

I would like some clarifications on the behavior of WifiManager.getScanResults(), namely :
When wireless is enabled
Does android scan for access points on a fixed interval ? Can one query/change the interval ? Can one query the time of the last scan ? For a discussion see this answer
What happens when the wireless radio is turned off (sleeps) - while wifi is still enabled - will getScanResults() go on returning the last scan results ? How would one know if it's time for startScan()?
When wireless is disabled
getScanResults() would return the last scan results ? Or an empty List ? Or null (it does return null at times and this is not handled by 90% of the snippets posted in SO) ?
The answer to 1 would be true even after a reboot (the phone booting with wifi off) ?
The reason I ask is I need to get the list of the available access points periodically and I'd rather call getScanResults() at once, than WifiManager.startScan() and then getScanResults() if I really do not have to - as this involves acquiring wifi locks and the like and is rather subtle. I am not also sure how much do the API level and phone hardware come into play.
For a good discussion of difficulties see this answer
When wireless is disabled
getScanResults() will return null...
...even after a reboot (that's to be expected - this would be disputed if it did not return null in the first place)
When wireless is enabled
2.Surprisingly enough getScanResults() will return null after some time (on a Nexus One, Android 2.3.7, Cyanogen mod - but I suspect this is not really relevant). So yes, apparently one has to initiate a scan irrespective of the wireless status
I guess this is true also if the state is WIFI_STATE_DISABLING
I am still interested in the answer in the case wireless is enabled - in particular question 2, if the device is asleep. Google groups won't let me post (hint)
public List getScanResults ()
Added in API LEVEL 1
Return the results of the latest access point scan.
Returns
the list of access points found in the most recent scan. An app must hold ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION permission in order to get valid results.

Categories

Resources