I try to get an intent action in my receiver just after the actual connection with a wireless network has been established.
I'm now working with "NETWORK_STATE_CHANGED_ACTION" but this is fired when the connection has been successful but not yet activated. It takes a few seconds to fully connect and that's when isConnected() returns true (which I use to mark some changes).
ConnectivityManager cm = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE);
NetworkInfo wifiNI = cm.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
wifiNI.isConnected();
I also tried using "SUPPLICANT_CONNECTION_CHANGE_ACTION" but I couldn't get any action in my receiver.
Any ideas?
EDIT:
Eventually, the solution was in "NETWORK_STATE_CHANGED_ACTION" where I should have paid attention to NetworkInfo state:
NetworkInfo networkInfo = intent.getParcelableExtra(WifiManager.EXTRA_NETWORK_INFO);
NetworkInfo.State state = networkInfo.getState();
if(state.equals(NetworkInfo.State.CONNECTED))
{
// wireless is now connected
}