Requirement in my application is to show Wifi signal strength on wifi signal change. For a first time i am calculating the Signal strength by following code.
int numberOfLevels=5;
WifiManager wifiManager = (WifiManager)getActivity().getSystemService(Context.WIFI_SERVICE);
WifiInfo wifiInfo = wifiManager.getConnectionInfo();
int level=WifiManager.calculateSignalLevel(wifiInfo.getRssi(), numberOfLevels);
I want to update UI frequently if wifi signal is change. Is there any broadcast available which notify me once signal strength is changed.
Do you any idea How can i achieve this functionality?
Apparently, yes: the broadcast action is "android.net.wifi.RSSI_CHANGED". See WifiManager.RSSI_CHANGED_ACTION
Have never used it personally though.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With