/**
 * 文件名：NetStatusReceiver.java
 * 描述：网络连接状态
 * 包名：cn.com.kmlt.monstarBase.utils.net
 * 作者：WENJQ
 * 创建日期：2016年05月26日
 * 
 */
package com.mgq.base.utils.net;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;

import com.mgq.base.utils.base.MiniApp;
import com.mgq.base.utils.toast.ToastUtil;


public class NetStatusReceiver extends BroadcastReceiver {
	@Override
	public void onReceive(Context context, Intent intent) {
		// TODO Auto-generated method stub
		ConnectivityManager connectMgr = (ConnectivityManager) context
				.getSystemService(Context.CONNECTIVITY_SERVICE);

		NetworkInfo wifiNetInfo = connectMgr.getActiveNetworkInfo();
		if (wifiNetInfo != null && wifiNetInfo.isAvailable()) {
			// connect network
			
			MiniApp.isOnline = true;


		} else {
			ToastUtil.showToast(context, "提醒:wifi已断开,请检查wifi后重新登录或在离线模式下继续使用!");
			MiniApp.isOnline = false;
			// disconnect network
		}
	}


}
