@@ -0,0 +1,2002 @@
+/**   %0A * @Title: NetworkStateChangeReceiver.java%0A * @Package me.pc.mobile.helper.receiver%0A * @Description: TODO%0A * @author SilentKnight %7C%7C happychinapc@gmail.com%0A * @date 2014 2014-11-19 %E4%B8%8A%E5%8D%8811:30:21%0A * @version V1.0.0 %0A */%0Apackage me.pc.mobile.helper.v14.receiver;%0A%0Aimport android.content.BroadcastReceiver;%0Aimport android.content.Context;%0Aimport android.content.Intent;%0Aimport android.net.ConnectivityManager;%0Aimport android.net.NetworkInfo;%0Aimport me.pc.mobile.helper.v14.util.LogUtil;%0A%0A/**%0A * @author SilentKnight %3C !-- Needed to check when the network connection%0A *         changes --%3E%0A * %0A *         %3C uses-permission%0A *         android:name=%22android.permission.ACCESS_NETWORK_STATE%22/%3E %3C receiver%0A *         android%0A *         :name=%22com.blackboard.androidtest.receiver.ConnectionChangeReceiver%22%0A *         android:label=%22NetworkConnection%22%3E %3C intent-filter%3E %3C action%0A *         android:name=%22android.net.conn.CONNECTIVITY_CHANGE%22/%3E %3C%0A *         /intent-filter%3E %3C /receiver%3E%0A * %0A * %0A *         %3Cuses-permission%0A *         android:name=%22android.permission.ACCESS_NETWORK_STATE%22/%3E%0A */%0Apublic class NetworkStateChangeReceiver extends BroadcastReceiver %7B%0A%09private static final String TAG = NetworkStateChangeReceiver.class%0A%09%09%09.getSimpleName();%0A%0A%09/*%0A%09 * (non-Javadoc)%0A%09 * %0A%09 * @see android.content.BroadcastReceiver#onReceive(android.content.Context,%0A%09 * android.content.Intent)%0A%09 */%0A%09@Override%0A%09public void onReceive(Context context, Intent intent) %7B%0A%09%09// TODO Auto-generated method stub%0A%09%09if (ConnectivityManager.CONNECTIVITY_ACTION.equals(intent.getAction())) %7B%0A%09%09%09LogUtil.info(TAG, %22Network Connection State changes%22);%0A%09%09%09ConnectivityManager connectivityManager = (ConnectivityManager) context%0A%09%09%09%09%09.getSystemService(Context.CONNECTIVITY_SERVICE);%0A%09%09%09NetworkInfo info = connectivityManager.getActiveNetworkInfo();%0A%09%09%09if (info != null && info.isAvailable()) %7B%0A%09%09%09%09String name = info.getTypeName();%0A%09%09%09%09LogUtil.info(TAG, %22%E5%BD%93%E5%89%8D%E7%BD%91%E7%BB%9C%E5%90%8D%E7%A7%B0%EF%BC%9A%22 + name);%0A%09%09%09%7D else %7B%0A%09%09%09%09LogUtil.info(TAG, %22%E6%B2%A1%E6%9C%89%E5%8F%AF%E7%94%A8%E7%BD%91%E7%BB%9C%22);%0A%09%09%09%7D%0A%09%09%7D%0A%09%7D%0A%0A%7D%0A

Create NetworkStateChangeReceiver.java