获取通话记录黑莓

时间:2014-06-19 11:33:18

标签: blackberry

我想要什么

嗨,我是BB开发的新手,想知道如何以编程方式获取所有调用日志列表,包括时间,数字等属性?

我读的内容

我已阅读此Link但未获得实施方式 对于黑莓手机也没有像Android或iOS那样的良好支持。

请建议我使用一些代码段 感谢

1 个答案:

答案 0 :(得分:2)

我认为你确实需要Java(BBOS)代码。

在我看来,你引用的链接提供了足够的信息来编写代码,但由于你似乎需要更多,我希望这会有所帮助:

PhoneLogs _logs = PhoneLogs.getInstance();
int numberOfCalls = _logs.numberOfCalls(PhoneLogs.FOLDER_NORMAL_CALLS);
System.out.println("Number of calls: " + Integer.toString(numberOfCalls));
for ( int i = 0; i < numberOfCalls; i++ ) {
    PhoneCallLog phoneLog = (PhoneCallLog)_logs.callAt(i,PhoneLogs.FOLDER_NORMAL_CALLS);
    int callType = phoneLog.getType();
    String callTypeString = "";
    switch (callType) {
    case PhoneCallLog.TYPE_MISSED_CALL_OPENED:
    case PhoneCallLog.TYPE_MISSED_CALL_UNOPENED:
        callTypeString = "Missed";
        break;
    case PhoneCallLog.TYPE_PLACED_CALL:
        callTypeString = "Placed";
        break;
    case PhoneCallLog.TYPE_RECEIVED_CALL:
        callTypeString = "Received";
        break;
    default:
        callTypeString = "Unknown";
        break;
    }
    PhoneCallLogID participant = phoneLog.getParticipant();
    System.out.println("Call: " + Integer.toString(i) + " " + callTypeString + " " + participant.getAddressBookFormattedNumber());
}

示例输出(来自调试日志):

Number of calls: 1
Call: 0 Placed 1 (234) 534-5343 5555