Reputation: 789
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
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 callsCallsLog.Calls.MISSED_TYPE
for missed callsCallsLog.Calls.OUTGOING_TYPE
for outgoing callsCallsLog.Calls.VOICEMAIL_TYPE
for voicemail callsYou 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