I am trying to get all the Call-Logs excluding SMS
but i get a merged list.
How can i filter call logs for calls only?
I am using following code.
String[] strFields = {
android.provider.CallLog.Calls.NUMBER,
android.provider.CallLog.Calls.TYPE,
android.provider.CallLog.Calls.CACHED_NAME,
android.provider.CallLog.Calls.CACHED_NUMBER_TYPE,
android.provider.CallLog.Calls.DATE
};
String strOrder = android.provider.CallLog.Calls.DATE + " DESC";
Uri calluri = Uri.parse("content://call_log/calls");
Cursor mCallCursor = getContentResolver().query(
calluri,
strFields,
null,
null,
strOrder
);
I am using Samsung Note 2 for testing.
I have the same issue on both of my samsung devices. Researching this issue indicates it is problem with how samsung handles the android logs, it merges them. Obviously this is incorrect and inconsistent behavior. Note, an sms message cannot be deleted through the call log api, yet it can be retrieved through the call log api.
CallLog.Calls provides feature to clarify, Incomming, Outgoing and Missed. All type of CallLog.Calls where its get other records also.
See below code:
Cursor managedCursor = getActivity().getContentResolver().query( CallLog.Calls.CONTENT_URI,null, null,null, null); int number = managedCursor.getColumnIndex( CallLog.Calls.NUMBER ); int name = managedCursor.getColumnIndex(CallLog.Calls.CACHED_NAME); int type = managedCursor.getColumnIndex( CallLog.Calls.TYPE ); int date = managedCursor.getColumnIndex( CallLog.Calls.DATE); int newcall = managedCursor.getColumnIndex(CallLog.Calls.NEW); int callduration = managedCursor.getColumnIndex( CallLog.Calls.DURATION); int id = managedCursor.getColumnIndex(CallLog.Calls._ID);