Wednesday, May 25, 2011

[android-developers] security exception while reading call logs?

hi,

i am just trying to read call logs .
here is my code.

public static void getCallLogs(Context context) {
try {
String[] strFields = { android.provider.CallLog.Calls.NUMBER,
android.provider.CallLog.Calls.TYPE,
android.provider.CallLog.Calls.CACHED_NAME,
android.provider.CallLog.Calls.CACHED_NUMBER_TYPE };
String strOrder = android.provider.CallLog.Calls.DATE + "DESC";

Cursor mCallCursor = context.getContentResolver().query(
android.provider.CallLog.Calls.CONTENT_URI, strFields,
null, null, strOrder);
// get start of cursor
if (mCallCursor.moveToFirst()) {

do {
Log.i("-----------Call
Id------------","."+mCallCursor.getString(mCallCursor.getColumnIndex(Calls._ID)));
Log.i("-----------Call
Number------------","."+mCallCursor.getString(mCallCursor.getColumnIndex(Calls.NUMBER)));

} while (mCallCursor.moveToNext());
}

} catch (Exception e) {

}
}


can anybody tell me what is wrong with this code?

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate