Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How are call types (Incoming/Outgoing/Missed) stored in Android Call Log?

Tags:

android

This may be a silly question, I'm a bit of a noob. I was reading this post: How do I access call log for android?

and in the answer at the bottom of the code they have this line:

int type = Integer.parseInt(c.getString(c.getColumnIndex(CallLog.Calls.TYPE)));// for call type, Incoming or out going

I'm a little confused as to how the call type is stored, is it as a string or as an integer? The line of code shown makes me think its saved as a number, but in string format. Can anyone explain this to me?

Thanks, Matt

like image 933
Matt Harris Avatar asked Oct 20 '11 12:10

Matt Harris


Video Answer


1 Answers

The type is stored as integer. This is how I get a list of new missed calls:

cursor = cr.query(Uri.parse("content://call_log/calls"), null, "type = 3 AND new = 1", null, "date DESC");

Of course using the CallLog.Calls.MISSED_TYPE, INCOMING_TYPE and OUTGOING_TYPE constant would be better.

like image 115
Pal Szasz Avatar answered Sep 30 '22 19:09

Pal Szasz