我希望获取设备的国家代码,而不使用sim卡。
例如:如果国家是斯里兰卡,则国家代码为LK。
我的最终目标是获取拨打代码(斯里兰卡为+94)。
我尝试使用以下方法:
TelephonyManager tm = (TelephonyManager)this.getSystemService(getApplicationContext().TELEPHONY_SERVICE);
String countryCodeValue = tm.getNetworkCountryIso();
但是这返回一个空字符串。