问题
I want to get the Signal strength of the WiFi network I am connected to , as it changes . This is my broadcast receiver
registerReceiver(new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
int info = Wifi.getConnectionInfo().getRssi();
textStatus.append("\n\n : " + Integer.toString(info));
}
}, new IntentFilter(WifiManager.RSSI_CHANGED_ACTION));
I am getting it only once . How do i get it as it changes ?
回答1:
Update: From tests in Android 4.4 and 5.0 the interval between sequential WiFi scans seems to be less than a second. You can take a look at my demo for RF measurements using Android device, here:
https://github.com/panosvas/Measurements
where you can find an implementation of WiFi measurements one after another. I have also created a Server for storing these measurements as well as a remote trigger app using UDP packets where you can find here:
https://github.com/panosvas/IndoorPositioningServer
Actually, you cannot take the RSSI each time it changes because it is possible that the RSSI value changes in a period of mseconds or even faster and each wifi measurement in Android takes approximately 5 seconds depending also on the device.
So, what you advice my answers in the following posts for that:
Wifi Scanner which scans 20 times
How to update wifi RSSI values without a click button
来源:https://stackoverflow.com/questions/24053048/android-getting-wifi-signal-strength-as-it-changes