1

i can get first sim cell tower id with this below code. but i want to get second sim2 cell id.

    TelephonyManager telephonyManager = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
    GsmCellLocation cellLocation = (GsmCellLocation) telephonyManager.getCellLocation();
  int   nowcid  = cellLocation.getCid();
  int nowlac = cellLocation.getLac();

there is many questions about this. but i tested all codes with android 6.0 samsung j7 2016 but didnt got the sim2 cell id. some people say this is impossible on other questions but Network Cell Info Lite app https://play.google.com/store/apps/details?id=com.wilysis.cellinfolite&hl=en gets cell id from sim2 on every device i tested.

1 Answers1

0

For MediaTek devices there is the hidden class com.mediatek.telephony.TelephonyManagerEx. Use reflection to access this class. This should work reliable on MTK devices. The simId paramater used has for SIM 0 value 0 and for SIM 2 value 1.

Study the very hard to find API description: http://www.lcis.com.tw/paper_store/ps_html/MediaTek_SDK_for_Android_Developers_Guide_v1_0-2016103002732388.pdf.html

There is a static getDefaultmethod.

For Qualcomm based phones there are hidden methods in the TelephonyManager. Just TelephonyManager.class.getDeclaredMethods() inside the debugger to see what is available.

k_o_
  • 5,143
  • 1
  • 34
  • 43