Is there any way by which one can get log call history(only duration of call) for a particular contact in android. Say there is "X" person in my contact list, I want to find out the duration of call we both talked( so both incoming and outgoing) in past days (it is user开发者_运维问答 given, can be a day, a week, a month etc.) .
I got across this code while searching but I think this might just give the last talk details. Please correct if I am wrong.
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
};
String strOrder = android.provider.CallLog.Calls.DATE + " DESC";
Cursor mCallCursor = getContentResolver().query(
android.provider.CallLog.Calls.CONTENT_URI,
strFields, null, null,strOrder);
Any help would be great :)
There could be two approach,
- put the right filter in Cursor.
- Iterate the Cursor to collect the data.
精彩评论