如何获得该国code为CDMA Android设备? [英] How to get the country code for CDMA Android devices?

查看:166
本文介绍了如何获得该国code为CDMA Android设备?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁知道如何在CDMA网络检索Android设备在全国code信息?

Does anyone know how to retrieve the country code information for Android devices under CDMA networks?

有关所有其他人,你可以使用为TelephonyManager

For all others, you can just use the TelephonyManager for that:

String countryCode = null;
TelephonyManager telMgr = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
if (telMgr.getPhoneType() != TelephonyManager.PHONE_TYPE_CDMA) 
    countryCode = telMgr.getNetworkCountryIso();
}
else {
    // Now what???
}

我搜索了一下,但没找到,这将导致一个答案任何有用的信息。
有的一些想法在脑海中:

I searched a bit but did not find any useful information that would lead to an answer. Some ideas some to mind:

  • GPS location: you can get the country from GeoCoder; and
  • IP Address: there are some nice APIs to get it, such as ipinfodb.

有没有人在上面做的方法之一,或实现更好的?

Does anyone have done one of the approaches above, or implemented better ones?

感谢您的帮助。

推荐答案

它适用于CDMA,但并非总是如此 - 取决于网络载体上

It works for CDMA, but not always - depends on the network carrier.

下面是一个另类想法,这表明看着传出短信或电话要弄清楚这个设备的电话号码,从基于国际拨号code则可以计算出CountryIso ...

Here's an alternative idea, which suggests looking at the Outgoing SMS or Calls to figure out this device's phone number, from which you can then figure out the CountryIso based on the international dialing code...

希望这有助于

这篇关于如何获得该国code为CDMA Android设备?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆