I am querying CallLog.Calls content provider for call details. Everything works fine except when I try to query by dates. That is, to get call details for a particular date or date range etc. I know the date are stored as long (millisecond format) so I tried to convert the date first and then query by it, but I must be doing something wrong here. Here's the query I am running, pls note that it works well when I remove the "WHERE DATE =" part or replace it by something like "WHERE TYPE=" etc. So, how do I run a query to get call details for a date or date range? Any help on this? Thanks.
Cursor c = getContentResolver().query(CallLog.Calls.CONTENT_URI, null,
CallLog.Calls.DATE + "<=?",
new String[] { String.valueOf(dateSTR)}, ORDER_BY);
startManagingCursor(c);
This is how i do it:
Cursor c = contentResolver.query(CallLog.Calls.CONTENT_URI,
new String[] { CallLog.Calls.DATE, CallLog.Calls.DURATION,
CallLog.Calls.NUMBER, CallLog.Calls._ID },
CallLog.Calls.DATE + ">?",
new String[] { String.valueOf(resetDate.getTime())},
CallLog.Calls.NUMBER + " asc");
resetDate is a Date variable, set to the beginning of the period i want to cover.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With