Back to project page ExampleChopping.
The source code is released under:
Apache License
If you think the Android project ExampleChopping listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.chopping.example; //from w w w .j a v a 2 s . c o m import com.chopping.example.bus.WifiEvent; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.net.NetworkInfo; import android.net.wifi.WifiManager; import android.text.TextUtils; import de.greenrobot.event.EventBus; /** * Receiver to detect status of Wifi. */ public final class WifiNetworkChangedReceiver extends BroadcastReceiver{ @Override public void onReceive(Context context, Intent intent) { NetworkInfo info = intent.getParcelableExtra(WifiManager.EXTRA_NETWORK_INFO); if(info!=null && TextUtils.equals(info.getTypeName(), "WIFI")) { EventBus.getDefault().post(new WifiEvent(info.isConnected())); } } }