如何区分Android应用程序中的移动运营商?

时间:2014-05-15 03:51:43

标签: android c mobile at-command cellular-network

我有一个使用.so文件的Android应用程序,.so根据手机连接的网络更改了他的行为,即如果您已连接到AT&T,则需要执行此操作XYZ。如果您使用Verizon,则执行ABC,否则执行XY

  1. 有没有什么好方法可以区分移动网络?
  2. 我想以某种方式使用PLMN,有没有强有力的做法 那? (我希望它在漫游等时工作。)。
  3. 我见过this,但我只需要在没有包装或Java参与的C代码中执行此操作,这意味着无法使用以下内容:

    TelephonyManager telephonyManager =((TelephonyManager) Context.getSystemService(Context.TELEPHONY_SERVICE));
    String operatorName = telephonyManager.getNetworkOperatorName();
    

2 个答案:

答案 0 :(得分:2)

您可以使用AT+COPS?命令获取当前使用的PLMN。来自27.007

+COPS?                               +COPS: <mode>[,<format>,<oper>[,<AcT>]]

...

Read command returns the current mode, the currently selected operator and the
current Access Technology. If no operator is selected, <format>, <oper> and <AcT>
are omitted.

...

<oper>: string type; <format> indicates if the format is alphanumeric or numeric;
long alphanumeric format can be upto 16 characters long and short format up to 8
characters (refer GSM MoU SE.13 [9]); numeric format is the GSM Location Area
Identification number (refer 3GPP TS 24.008 [8] subclause 10.5.1.3) which
consists of a three BCD digit country code coded as in ITU-T E.212 Annex A
[10], plus a two BCD digit network code, which is administration specific;
returned <oper> shall not be in BCD format, but in IRA characters converted from
BCD; hence the number has structure: (country code digit 3)(country code digit 2)
(country code digit 1) (network code digit 3)(network code digit 2)(network code
digit 1)

答案 1 :(得分:0)

使用以下两个at命令(see also

AT+COPN         7.21            -  Read operator names 
AT+COPS         7.3             -  PLMN selection