Code example for TelephonyManager

Methods: getNetworkOperatorName, getPhoneType

0
 
		TelephonyManager manager = (TelephonyManager) context
				.getSystemService(Context.TELEPHONY_SERVICE);
		 
		if (manager != null) {
			telephony.put("carrier",  manager.getNetworkOperatorName());
			 
			telephony.put("radio", getRadio(manager));
		} 
		 
		return telephony;
	} 
	 
	private String getRadio(TelephonyManager manager) {
		switch(manager.getPhoneType()) {
	        case 0x00000000:  
	            return "none"; 
	        case 0x00000001: 
	            return "gsm"; 
	        case 0x00000002: 
	            return "cdma";