我正在注册接收器onResume()
:
registerReceiver(wifiConnectivityReceiver, new
IntentFilter(WifiManager.SUPPLICANT_CONNECTION_CHANGE_ACTION));
这是接收器本身:
class WiFiConnectivityReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getBooleanExtra(WifiManager.EXTRA_SUPPLICANT_CONNECTED,false)){
Log.d(TAG,"Connected to network!");
} else {
Log.d(TAG,"Could not connect to network!");
}
}
}
在我的应用程序中,我能够连接到选定的 WiFi 网络,但这SUPPLICANT_CONNECTION_CHANGE_ACTION
从未被触发。如果我将其更改SUPPLICANT_STATE_CHANGED_ACTION
为例如它正在工作。
我正在研究 ICS。
其他人是否遇到过这样的问题?