Android移动设备实际上确实知道它在哪里 - 但有没有办法通过国家代码或国家/地区名称来检索国家/地区?
无需知道确切的GPS位置 - 国家代码或名称就足够了,我正在使用以下代码:
String locale = context.getResources().getConfiguration().locale.getCountry(Locale.getDefault());
System.out.println("country = "+locale);
Run Code Online (Sandbox Code Playgroud)
但它给了我"美国"代码,
但我的设备保存在印度; 有没有办法找到设备当前国家代码而不使用GPS或网络提供商.因为我正在使用平板电脑 提前致谢.