문제

I have an Android application which uses an .so file, The .so changes his behavior according the network the phone connected to, i.e. if you are connected to AT&T you need to do XYZ. if you work on Verizon you do ABC otherwise you do XY.

  1. Is there any good way to differentiate between mobile networks?
  2. I thought to use PLMN somehow, Is there any robust way of doing that? (I want it to work while roaming too etc.).

I had seen this, but I need to do it only in the C code with no wrappers or Java engagement, meaning the following can't be used:

TelephonyManager telephonyManager =((TelephonyManager) Context.getSystemService(Context.TELEPHONY_SERVICE));
String operatorName = telephonyManager.getNetworkOperatorName();
도움이 되었습니까?

해결책

You can get the currently used PLMN with the AT+COPS? command. From 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)

다른 팁

Using the following two at commands (see also)

AT+COPN         7.21            -  Read operator names 
AT+COPS         7.3             -  PLMN selection 
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top