I am trying to get the country telephonic code by reading geolocation on app start.
But I would get only latitude and longitude. How to get the telephonic code from geolocation.
I have done this far see :
First in String xml I would create an array like this
<string-array name="CountryCodes" >
<item>91,IN</item>
.....
.....
.....
</string-array>
public String GetCountryZipCode(){
String CountryID="";
String CountryZipCode="";
TelephonyManager manager = (TelephonyManager) this.getSystemService(Context.TELEPHONY_SERVICE);
//getNetworkCountryIso
CountryID= manager.getSimCountryIso().toUpperCase();
String[] rl=this.getResources().getStringArray(R.array.CountryCodes);
for(int i=0;i<rl.length;i++){
String[] g=rl[i].split(",");
if(g[1].trim().equals(CountryID.trim())){
CountryZipCode=g[0];
break;
}
}
return CountryZipCode;
}
Now suppose I read geolocation but how would I know country name or country code(more easy if I get this)