farhang67
farhang67

Reputation: 789

android.provider.CallLog.Calls.TYPE outgoing call not answered and outgoing call rejected?

I'm developing a call logs app. using below code, callType possible values I know are: 1 = incoming call answered, 2 = outgoing call, 3 = incoming call not answered, 5 = incoming call rejected. what are values for outgoing call not answered" and "outgoing call rejected"

String strOrder = android.provider.CallLog.Calls.DATE + " DESC";
Uri callUri = Uri.parse("content://call_log/calls");
Cursor cur = cr.query(callUri, null, null, null, strOrder);
// loop through cursor
while (cur.moveToNext()) {
     String callType = cur.getString(cur.getColumnIndex(android.provider.CallLog.Calls.TYPE));
}

Upvotes: 1

Views: 991

Answers (1)

Chaoz
Chaoz

Reputation: 2260

You should never use an int to check for a type (eg. if (callType == 1)) as that 1 may mean something else in different Android versions. Instead, use the constants given by the API. In your case, these are

  • CallsLog.Calls.INCOMING_TYPE for incoming calls
  • CallsLog.Calls.MISSED_TYPE for missed calls
  • CallsLog.Calls.OUTGOING_TYPE for outgoing calls
  • CallsLog.Calls.VOICEMAIL_TYPE for voicemail calls

You should never bother which constant has what value (1, 2 or 3), as those may change, but their names (INCOMING_TYPE, MISSED_TYPE, OUTGOING_TYPE, VOICEMAIL_TYPE) definitely won't change.

Hope this helped!

Upvotes: 1

Related Questions