I want my app to be able to tell whether a call was missed, or just dismissed (hitting the red end button when there is an incoming call).
Do I use the CallLog.Calls NEW constant?
in your manifest file add :
<uses-permission android:name="android.permission.READ_CONTACTS" />
and in your activity add:
Uri allCalls = Uri.parse("content://call_log/calls");
Cursor c = getContentResolver().query(allCalls, null,
CallLog.Calls.NEW + " = ?", new String[] { "1" }, null);
c.moveToFirst();
String num= c.getString(c.getColumnIndex(CallLog.Calls.NUMBER));
String name= c.getString(c.getColumnIndex(CallLog.Calls.CACHED_NAME));
String duration = c.getString(c.getColumnIndex(CallLog.Calls.DURATION));
String type = c.getString(c.getColumnIndex(CallLog.Calls.TYPE));
Log.d("num", num);
Log.d("name", name);
Log.d("duration", duration);
Log.d("type", type);