获取国家TelephonyManager与locale.getCountry() [英] Get country TelephonyManager vs locale.getCountry()
本文介绍了获取国家TelephonyManager与locale.getCountry()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
两者之间有什么区别?
String locale = context.getResources().getConfiguration().locale.getCountry();
和
TelephonyManager tm = (TelephonyManager)this.getSystemService(this.TELEPHONY_SERVICE);
String countryCodeValue = tm.getNetworkCountryIso();
我需要的是这样的(很难测试).用户来自美国,带着SIM卡前往法国,并在国外使用SIM卡,该设备始终使用英语(US).我需要他到达法国时从代码中获得法国.怎么做对呢?
What I need is like this (hard to test it). The user is from US and travels to France with his sim card and uses his sim card abroad, the device is in English (US) all the time. I need when he arrives to France get France from code. How to do it right?
推荐答案
查看全文