I am working on wifi functionnalities in android. So that, i would like to display current values of wifi informations(siganl level,frequency,rate..) in textViews.We know that some parameters can vary widely over time.My problème is how to uptdate the current display value?
i am using that code:
String service = Context.WIFI_SERVICE;
final WifiManager wifi = (WifiManager)getSystemService(service);
WifiInfo info = wifi.getConnectionInfo();
int strenght = WifiManager.calculateSignalLevel(info.getRssi(),5);
int speed = info.getLinkSpeed();
String units = WifiInfo.LINK_SPEED_UNITS;
String ssid2 = info.getSSID();
When i retreive strenght=48 in a textView at an instant t1 for example, it will keep the same value at another instant ti.But we know that this is not the current value!
Then,I want also to understand how can i do when i display a list of available wifi connections in an first activity A1(i did this), how to retreive the current value of signal level in an secon activity A2. What i have tried to do is to use an intermediate object to share the value of signal level between A1 and A2. But here also,i have the same values, no updating!
Plz helllp
I think you’ll want to use a BroadcastReceiver to detect changes in the WiFi connection. This looks similar to what you’re trying to do:
http://android-er.blogspot.com/2011/01/monitor-wifi-status-and-information.html