开发者

Call log in Android

开发者 https://www.devze.com 2023-03-16 15:14 出处:网络
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

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,

  1. put the right filter in Cursor.
  2. Iterate the Cursor to collect the data.
0

精彩评论

暂无评论...
验证码 换一张
取 消