简体   繁体   English

我想从通话记录中获得最多拨打和接收的联系方式

[英]I want to get most dialed and recieved contact from call log

i want to get one number who is most appeared in call logs, for example 12345 is a number and it is most dialed, recieved and missed called number and i want to get it. 我想得到一个最常出现在呼叫日志中的号码,例如12345是一个号码,并且它是拨打,接听和错过的被叫号码最多的号码,我想得到它。

here is what i'm trying: 这是我正在尝试的:

 private String getCallDetails() {

    StringBuffer sb = new StringBuffer();
    Cursor managedCursor = managedQuery(CallLog.Calls.CONTENT_URI, null,
            null, null, null);
    int number = managedCursor.getColumnIndex(CallLog.Calls.NUMBER);
    int type = managedCursor.getColumnIndex(CallLog.Calls.TYPE);
    int date = managedCursor.getColumnIndex(CallLog.Calls.DATE);
    int duration = managedCursor.getColumnIndex(CallLog.Calls.DURATION);
    sb.append("Call Details :");
    while (managedCursor.moveToNext()) {
        String phNumber = managedCursor.getString(number);
        String callType = managedCursor.getString(type);
        String callDate = managedCursor.getString(date);
        Date callDayTime = new Date(Long.valueOf(callDate));
        String callDuration = managedCursor.getString(duration);
        String dir = null;
        int dircode = Integer.parseInt(callType);
        switch (dircode) {
        case CallLog.Calls.OUTGOING_TYPE:
            dir = "OUTGOING";
            break;

        case CallLog.Calls.INCOMING_TYPE:
            dir = "INCOMING";
            break;

        case CallLog.Calls.MISSED_TYPE:
            dir = "MISSED";
            break;
        }
        sb.append("\nPhone Number:--- " + phNumber + " \nCall Type:--- "
                + dir + " \nCall Date:--- " + callDayTime
                + " \nCall duration in sec :--- " + callDuration);
        sb.append("\n----------------------------------");
    }
    managedCursor.close();
    return sb.toString();

}

I think what you are looking for is CONTENT_FREQUENT_URI in ContactsContract.Contacts . 我认为您正在寻找的是ContactsContract.Contacts CONTENT_FREQUENT_URI An example of its usage is given here 这里给出一个用法示例

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Android - 如何从通话记录中获取联系人? - Android - How to get a contact from call log? 我想从通话记录中获取来电号码,但不重复该号码如果对相同号码重复该过程 - i Want to get incoming number from call log , but Without repeating the number If the process is repeated for the same number Android:我无法从通话记录历史中获取正确的日期? - Android: i unable to get the correct date from the call log history? 我想从电话联系人中检索联系人照片。 我应该如何获取联系人照片? - I want to retrieve the contact photo from the phone contacts. How should i proceed with getting the contact photo? 我想获取联系人姓名和电话号码,但是我的代码只是打印联系人姓名,所以我怎么也可以获取电话号码 - I want to get the contact name and number but my code just prints the contact name so how can I also get the number 我想从jsp页面调用servlet - I want to call servlet from jsp page Log4j同步我想捕获log4j:ERROR setFile(null,true)调用失败 - Log4j synchronous I want to catch log4j:ERROR setFile(null,true) call failed 如何按照收到的顺序从多个请求中获取http响应 - How to get http responses from multiple requests in the order they're recieved 我不想从axboot记录一个jpa查询 - I don't want to log a jpa query from axboot 如何获取正在拨打的号码,Android中的外拨号码 - How to get the number that is being dialed the , the outgoing number in android
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM