Code example for TelephonyManager

Methods: getNetworkCountryIso

0
	 * @return 
	 */ 
	public static String getCountry(Context context){
		 TelephonyManager telmngr = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
		  
		 String networkCountryISO = telmngr.getNetworkCountryIso();
		  
		 //if there is no phone connection (or in flight mode) the "networkCountryISO" is empty 
		 if(!StringUtils.isEmpty(networkCountryISO)){
			 //if its not empty, return it 
			 return networkCountryISO;
		 }else{ 
			 // if its empty, return the default locale 
			 return Locale.getDefault().getCountry();
		 } 
	} 
}