Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the WiFi noise level in Android?

     I want to implement an app which measures the quality of the WiFi signal from an indoor environment. From my research I found that the best way to get an accurate measurement is not to get only the RSSI but instead to use the SNR (Signal to Noise Ratio).

How can I obtain the noise level from the Android SDK? As I heard, there is no API available for this. However, I've found a method which provides the SNR (getEvdoSnr()). Unfortunately, this one works only for a GSM/CDMA signal and not for a WiFi connection.

Is anything possible to calculate the SNR in Android? I believe that's doable because I've found an app on Play store (called WiFi SNR) which successfully measures this ratio.


NOTE: The Android ScanResult doesn't provide the noise level, even if it's specified in the official documentation:

Describes information about a detected access point. In addition to the attributes described here, the supplicant keeps track of quality, noise, and maxbitrate attributes, but does not currently report them to external clients.

like image 697
Cosmin Telescu Avatar asked Aug 09 '17 10:08

Cosmin Telescu


1 Answers

Use https://developer.android.com/reference/android/net/wifi/ScanResult.html.

Describes information about a detected access point. In addition to the attributes described here, the supplicant keeps track of quality, noise, and maxbitrate attributes, but does not currently report them to external clients.

I bet something like this will give to you desired information:

WifiManager manager = (WifiManager) getApplication().getSystemService(Context.WIFI_SERVICE);
for (ScanResult result : wifiManager.getScanResults()) {
   // do your stuff
}
like image 180
Jordi Castilla Avatar answered Oct 01 '22 21:10

Jordi Castilla