如何以编程方式从呼叫日志中获取SIM1或SIM2

时间:2017-12-14 06:15:36

标签: android android-phone-call

在我的应用程序中,我需要将调用日志显示为sim1或sim2 我能够获得号码,姓名,传入或传出时间戳,但我无法检索使用哪个SIM卡插槽。

我使用以下代码:

  Uri callUri = Uri.parse("content://call_log/calls");
  String strOrder = CallLog.Calls.DATE + " DESC";

  Cursor cursor_call_logs = getContentResolver().query(callUri, null,null, null,strOrder);

  while (cursor_call_logs.moveToNext()) {
     String num = cursor_call_logs.getString(cursor_call_logs.getColumnIndex(CallLog.Calls.NUMBER));
     String name = cursor_call_logs.getString(cursor_call_logs.getColumnIndex(CallLog.Calls.CACHED_NAME));
     String duration = cursor_call_logs.getString(cursor_call_logs.getColumnIndex(CallLog.Calls.DURATION));
     int type = Integer.parseInt(cursor_call_logs.getString(cursor_call_logs.getColumnIndex(CallLog.Calls.TYPE)));
     String callDate = cursor_call_logs.getString(cursor_call_logs
                                        .getColumnIndex(CallLog.Calls.DATE));

    Log.e("VIA_NUMBER", "val@@ " + cursor_call_logs.getColumnIndex("VIA_NUMBER"));
    Log.e("normalized_number", "val@@ " + cursor_call_logs.getColumnIndex("normalized_number"));
    Log.e("subscription_id", "val@@ " + cursor_call_logs.getColumnIndexOrThrow("subscription_id"));

如何检索用于通话的SIM卡插槽。

0 个答案:

没有答案