Reputation: 255
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?
Upvotes: 4
Views: 1277
Reputation: 55350
Apparently, yes: the broadcast action is "android.net.wifi.RSSI_CHANGED"
. See WifiManager.RSSI_CHANGED_ACTION
Have never used it personally though.
Upvotes: 4