2

Samsung(dual sim) before offical android 6.0(not cm) device, I could get call logs with sim slot id, but Samsung(dual sim) android 6.0+ device I get an issue:

String  slotId = cursor.getString(cursor.getColumnIndex(CallLog.Calls.PHONE_ACCOUNT_ID));

<i>slotId</i> = null; but in another device (Huawei mate 8) is work fine

Did samsung modify the com.android.providers.contacts and contacts2.db?

Can someone guide through the solution for this?

shuabing
  • 679
  • 11
  • 28
  • Hey man your answer was really helpful.. One problem though I am not able to register a content observer on this uri... any ideas? – dirtydexter Aug 01 '16 at 07:48
  • In my app, just register a content observer on Uri.parse(CallLog.Calls.CONTENT_URI); this uri is base database table,uri = Uri.parse("content://logs/call"); is a view create from it,so just create one content observer on Uri.parse(CallLog.Calls.CONTENT_URI); is work fine, have fine and good luck – shuabing Aug 01 '16 at 10:08

1 Answers1

2

Update news : I find one solution

  boolean s_bSamsung;
if (Build.VERSION_CODES.M <= Build.VERSION.SDK_INT && s_bSamsung){
   uri = Uri.parse("content://logs/call");
}else {
  uri = Uri.parse(CallLog.Calls.CONTENT_URI);
}

use sim_id find sim slot

shuabing
  • 679
  • 11
  • 28