我有阅读通话记录的代码
String[] strFields = {
android.provider.CallLog.Calls.DATE,
android.provider.CallLog.Calls.TYPE,
android.provider.CallLog.Calls.DURATION,
android.provider.CallLog.Calls.NUMBER
};
//READ CALL LOG
Cursor callCursor = getContentResolver().query(android.provider.CallLog.Calls.CONTENT_URI,strFields, null, null,android.provider.CallLog.Calls.DATE + " ASC");
startManagingCursor(callCursor);
int dateColumn = callCursor.getColumnIndex(android.provider.CallLog.Calls.DATE);
// type can be: Incoming, Outgoing or Missed
int typeColumn = callCursor.getColumnIndex(android.provider.CallLog.Calls.TYPE);
// get duration of calls
int durationColumn = callCursor.getColumnIndex(android.provider.CallLog.Calls.DURATION);
// get number
int numberColumn = callCursor.getColumnIndex(android.provider.CallLog.Calls.NUMBER);
Calendar calendarCall = Calendar.getInstance();
if(callCursor.moveToFirst()){
do{
callDate = callCursor.getLong(dateColumn);
callType = callCursor.getInt(typeColumn);
callDuration = callCursor.getInt(durationColumn);
callNumber = callCursor.getString(numberColumn);
switch(callType){
case android.provider.CallLog.Calls.INCOMING_TYPE:
break;
case android.provider.CallLog.Calls.MISSED_TYPE:
break;
case android.provider.CallLog.Calls.OUTGOING_TYPE:
break;
}
}while(callCursor.moveToNext());
}
现在问题是Viber调用也包括在内但我想排除它们。有没有办法从通话记录中排除Viber呼叫?感谢
答案 0 :(得分:0)
取决于标志/列。你找到了任何标志,可以帮助你认识Viber电话吗?如果没有,则无法从日志中获取它。