Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get signal strength of WIFI and Mobile Data

In my app I need to check the connection speed of both WiFi and Mobile Data and then compare it, then switch to which ever network has the highest speed.

  • So how can I get the speed or best signal strength of wifi and mobile data?
  • how can I switch one off and other on programatically.

Please help me out. A sample would be helpful.

like image 923
WISHY Avatar asked Aug 23 '13 09:08

WISHY


People also ask

How do I check signal strength of a different network?

For AndroidGo to the Settings app > About phone > Status > SIM status > Signal Strength. You will see numbers expressed in dBm (decibel milliwatts).

Is there any app to see signal strength of all networks available in Android?

Network Cell Info Lite is our most recommended app. It features extensive measurement and diagnostics tools for cellular and WiFi networks. The most important is a color-coded gauge that makes reading and understanding your signal strength easy. It provides almost real-time results.


1 Answers

Wifi:

WifiManager wifiManager = (WifiManager)context.getSystemService(Context.WIFI_SERVICE);
int linkSpeed = wifiManager.getConnectionInfo().getRssi();

In case of mobile it should work:

TelephonyManager telephonyManager =        (TelephonyManager)this.getSystemService(Context.TELEPHONY_SERVICE);
CellInfoGsm cellinfogsm = (CellInfoGsm)telephonyManager.getAllCellInfo().get(0);
CellSignalStrengthGsm cellSignalStrengthGsm = cellinfogsm.getCellSignalStrength();
cellSignalStrengthGsm.getDbm();

Then You should compare this signal levels and if WIFI signal is better keep it turn on, but if mobile is better disconnect wifi

like image 110
pepe-pa Avatar answered Oct 04 '22 19:10

pepe-pa