In my application, I get the entire call log using this code. I am returning to me the entire call log on my Android phone.
public class CallLogHelper {
public static Cursor getAllCallLogs(ContentResolver cr) {
String strOrder = android.provider.CallLog.Calls.DATE + " DESC";
Uri callUri = Uri.parse("content://call_log/calls");
Cursor curCallLogs = cr.query(callUri, null, null, null, strOrder);
return curCallLogs;
}
public static void insertPlaceholderCall(ContentResolver contentResolver,
String name, String number) {
ContentValues values = new ContentValues();
values.put(CallLog.Calls.NUMBER, number);
values.put(CallLog.Calls.DATE, System.currentTimeMillis());
values.put(CallLog.Calls.DURATION, 0);
values.put(CallLog.Calls.TYPE, CallLog.Calls.OUTGOING_TYPE);
values.put(CallLog.Calls.NEW, 1);
values.put(CallLog.Calls.CACHED_NAME, name);
values.put(CallLog.Calls.CACHED_NUMBER_TYPE, 0);
values.put(CallLog.Calls.CACHED_NUMBER_LABEL, "");
Log.d("Call Log", "Inserting call log placeholder for " + number);
contentResolver.insert(CallLog.Calls.CONTENT_URI, values);
}
}
But my problem is that I want to get the call log from a specific date, not the entire call log. I do not know how to use the query to get the call log from a specific date. Help me thanks
source
share