我有阅读通话记录的代码
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 通话?谢谢