我怎么能不使用GPS得到我的Android设备的国家代码?

Android手机确实很好哪里知道但有一条检索国家类似的国家代码或国家的名字

不需要知道确切的GPS位置-国家代码或名称就足够了下面的代码

 String locale = context.getResources().getConfiguration().locale.getCountry(Locale.getDefault());      
 System.out.println("country = "+locale);

 

 

但我的设备放在印度;有没有办法找到设备的当前国家代码不使用GPS或网络提供商。因为我用平板。先谢谢了

解决方案:

String locale = context.getResources().getConfiguration().locale.getCountry();

 

猜你喜欢

转载自dasheny.iteye.com/blog/2172580
今日推荐