Android Dual SIM Signal Strength


Answer :

For this particular version of TelephonyManager, instead of using

TelephonyManager.listen (phoneStateListener, state)

which only listens on the default SIM, you may try using 2 instances of your PhoneStateListener, and call

TelephonyManager.listenGemini (phoneStateListener1, state, 0) for the 1st SIM, and

TelephonyManager.listenGemini (phoneStateListener2, state, 1) for the 2nd SIM,

where the third parameter for listenGemini is the SIM number.


Thanks for the answer headuck! I have not tried your solution, but i found my own solution which worked.

It is possible to use a different constructor for the TelephonyManager where you can pass in the sim card slot you want control over:

    MultiSimClass = Class.forName("android.telephony.MultiSimTelephonyManager");      for (Constructor<?> constructor : MultiSimClass.getConstructors()){          if (constructor.getParameterTypes().length == 2){               try {                    multiSimTelephonyManager1 = constructor.newInstance(context,0);                    multiSimTelephonyManager2 = constructor.newInstance(context,1);              }          }      } 

Comments

Popular posts from this blog

Converting A String To Int In Groovy

"Cannot Create Cache Directory /home//.composer/cache/repo/https---packagist.org/, Or Directory Is Not Writable. Proceeding Without Cache"

Android How Can I Convert A String To A Editable