我想在我的 wifi 信号低于 20% 时打开我的应用程序如何实现?下面是wifi信号强度的代码
WifiManager wifiManager = (WifiManager)context.getSystemService(Context.WIFI_SERVICE);
final WifiInfo connectionInfo = wifiManager.getConnectionInfo();
int rssi = connectionInfo.getRssi();
int level = WifiManager.calculateSignalLevel(rssi, 10);
int percentage = (int) ((level/10.0)*100);