如何从CallLog获得精确的持续时间(毫秒)

时间:2014-11-06 13:16:03

标签: android duration calllog

如何从CallLog中找出确切的呼叫持续时间(以毫秒为单位)?

我只得到四舍五入的数字。

    Uri allCalls = Uri.parse("content://call_log/calls");
    Cursor c = getActivity().getBaseContext().getContentResolver().query(allCalls, null, null, null, null);
    if(c != null && c.moveToFirst()) {
        int type = Integer.parseInt(c.getString(c.getColumnIndex(CallLog.Calls.TYPE)));// for call type, Incoming or out going

        if (type == 2){
            long duration = c.getLong(c.getColumnIndex(CallLog.Calls.DURATION));
        }
    }
    c.close();

0 个答案:

没有答案