I want to get calls from Android CallLog.Calls which were made from a specific SIM. Is there's a way to check which SIM was used to make call?
The following method allows to check SIM when call is performed and app is running.
(TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE).getSimSerialNumber();
How to check which SIM was used to make calls before app is installed?
Asked
Active
Viewed 837 times
0

Dubrovin
- 245
- 3
- 13
1 Answers
0
In the CallLog.Calls class, there don't seems any field that keeps SIM Information (like which SIM is used while making an outgoing call).
So, I guess it make no difference if your app was installed or not installed, the Call Log Content provider does not seems to maintain SIM-Sepcific, such as from which SIM the call has been initiated.

AADProgramming
- 6,077
- 11
- 38
- 58
-
Does it mean that if user changes SIM card in a single-SIM device, it's impossible to check which one was used to make a call from log? – Dubrovin Feb 03 '15 at 11:15
-
i guess you may try `telephonyManager.getSimSerialNumber();` to get SIM serial number which is unique within the operator. Save this value and later if you change the SIM card, it should return you different value. This way, in a single-SIM device, you can still obtain info. I myself didn't try that though but worth trying once I guess, if it is your core functionality – AADProgramming Feb 03 '15 at 12:30
-
@ AADTechnical, thanks for the advice, it works. But I need to know if it's possible to check which SIM was used to make a call before app is installed. – Dubrovin Feb 03 '15 at 16:41
-
AFAIK, this can only be acheived by "sticky" broadcast , to which your app can query as and when it is installed on device. But I never heard of any Android system broadcast that populates SIM Info when SIM is added/pulled from Device, which is STICKY. There is a Broadcast in Android when SIM state change `android.intent.action.SIM_STATE_CHANGED` .....but your app can only get it when it is already installed on device. – AADProgramming Feb 04 '15 at 04:41