Esempio n. 1
0
 /**
  * 获取当前网络类型
  *
  * @return 0:没有网络 1:WIFI网络 2:WAP网络 3:NET网络
  */
 public int getNetworkType() {
   int netType = 0;
   NetworkInfo networkInfo = NetworkStatusManager.getInstance().getNetworkInfo();
   if (networkInfo == null) {
     return netType;
   }
   int nType = networkInfo.getType();
   if (nType == ConnectivityManager.TYPE_MOBILE) {
     String extraInfo = networkInfo.getExtraInfo();
     if (!StringUtil.isEmpty(extraInfo)) {
       if (extraInfo.toLowerCase().equals("cmnet")) {
         netType = NETTYPE_CMNET;
       } else {
         netType = NETTYPE_CMWAP;
       }
     }
   } else if (nType == ConnectivityManager.TYPE_WIFI) {
     netType = NETTYPE_WIFI;
   }
   return netType;
 }
Esempio n. 2
0
 @Override
 public void onTerminate() {
   super.onTerminate();
   NetworkStatusManager.getInstance().stopListening();
 }
Esempio n. 3
0
 protected void init() {
   NetworkStatusManager.init(this);
   LocalDisplay.init();
 }