I want my app to detect the wifi that is connected.
For example, i wanna know how the app can connect to wifi and tell me that it has already been connected.
I want my app to detect the wifi that is connected.
For example, i wanna know how the app can connect to wifi and tell me that it has already been connected.
 
    
    public class WiFiChangeBroadcastReceiver extends BroadcastReceiver {
    private String LOGTAG = getClass().getSimpleName();
    @Override
    public void onReceive(Context context, Intent intent) {
        Log.d(LOGTAG, "WiFi Status Changed");
        if (intent.getAction().equals(WifiManager.NETWORK_STATE_CHANGED_ACTION)) {
            NetworkInfo networkInfo = intent
                    .getParcelableExtra(WifiManager.EXTRA_NETWORK_INFO);
            if (networkInfo.isConnected()) {
                Log.d(LOGTAG,
                        "Wifi is connected: " + String.valueOf(networkInfo));
            }
        }
    }
}
Android Manifest :
    <receiver android:name=".WiFiChangeBroadcastReceiver" >
        <intent-filter>
            <action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
            <action android:name="android.net.wifi.STATE_CHANGE" />
        </intent-filter>
    </receiver>
