Code example for TelephonyManager

Methods: getNetworkType

0
			Context context = Director.getInstance().getContext();
			TelephonyManager tm = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
			if(tm == null)
				type = NetworkType.NONE;
			else { 
				int t = tm.getNetworkType();
				if(t == TelephonyManager.NETWORK_TYPE_GPRS || t == TelephonyManager.NETWORK_TYPE_UNKNOWN)
					type = NetworkType.G2;
				else if(t == TelephonyManager.NETWORK_TYPE_EDGE)
					type = NetworkType.EDGE;
				else 
					type = NetworkType.G3;
			} 
		} 
	 
		return type.ordinal();
	} 
	 
	/// check proxy existence or not 
	static boolean hasProxy() { 
		return !TextUtils.isEmpty(Proxy.getDefaultHost());