WiFiManager has an addNetwork(wifiConfiguration) method which allows to programmatically add a new network. This is also performed behind the scenes by the system whenever the user/native-manager tries to connect to a new access point and I want to listen to this event.
I tried:
IntentFilter myStateChanged = new IntentFilter();
myStateChanged.addAction( WifiManager.NETWORK_IDS_CHANGED_ACTION );
ctx.registerReceiver(myStateChgRcvr, myStateChanged);
But in my broadcast receiver what do I do with the intent object to get the desired info? I want to ascertain that this is indeed a case of a new network profile added and I want to get that network's info:
private BroadcastReceiver myStateChgRcvr = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent i) {
i.getParcelab开发者_高级运维leExtra(...)); //???
}
};
Many thanks,
Spitzer
But in my broadcast receiver what do I do with the intent object to get the desired info?
Nothing. There are no documented Intent
extras on that Intent
.
I want to ascertain that this is indeed a case of a new network profile added and I want to get that network's info:
Call getConfiguredNetworks()
on WifiManager
and see if anything has changed, I guess.
精彩评论