Android Dual SIM LAC:CID:CSQ:Operator IMEI 2 reporting

老子叫甜甜 提交于 2019-12-11 13:38:32

问题


My testing phone is Samsung A3 with Android 5.0.2.

When SIM2 is inserted and slot 1 is empty

getNetworkOperator()
onSignalStrengthChanged()
onCellLocationChanged()

reports LAC, CID, CSQ & operator for SIM2.

When SIM1 is inserted, all data is for SIM1. Data for SIM2 is not reported.

What must I do to get LAC:CID:CSQ:OPER for both SIMs paralelly?

EDIT

Answer about LAC:CID:CSQ is in: Android signal strength

But how to get network operators for both SIMs?

=== SUMMARY EDIT WITH COMPLETE ANSWER ===

According to @headuck post in: Android signal strength
where in class:

public class MultiSimListener extends PhoneStateListener

is signal strenghts listener:

public void onSignalStrengthsChanged(SignalStrength signalStrength) {}    

to get current LAC:CID should be added:

public void  onCellLocationChanged (CellLocation cl){}

and to get network current operator (this may changed in roaming) with numeric, alpha short & alpha long values:

public void onServiceStateChanged(ServiceState serviceState){}

and in tm.listen must be added LISTEN_ values:

tm.listen(listener[subIdList[i]], 
     PhoneStateListener.LISTEN_SIGNAL_STRENGTHS 
    | PhoneStateListener.LISTEN_CELL_LOCATION
    | PhoneStateListener.LISTEN_SERVICE_STATE);    

where tm is TelephonyManager instance.

In addition to get IMEI1, IMEI2, presence DualSIM, SIM's and roaming in both slots, the ready to use is TelephonyInfo class in Android : How to get SIM ID of both SIM in Dual SIM mobile @Anand Makwana post.

All this work pretty well for Android 5.0, I dont know how to 5.1.

In Android 4 MultiSimListener not working, but TelephonyInfo is OK.

来源:https://stackoverflow.com/questions/35101020/android-dual-sim-laccidcsqoperator-imei-2-reporting

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!