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

2011-05-25 Thread Hitendrasinh Gohil
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


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

2011-05-25 Thread TreKing
On Wed, May 25, 2011 at 1:42 PM, Hitendrasinh Gohil 
hitendra.virtuei...@gmail.com wrote:

 can anybody tell me what is wrong with this code?


No error, exception, or stack trace posted.

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

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

2011-05-25 Thread Hitendrasinh Gohil
E/DatabaseUtils(  113): java.lang.SecurityException: Permission Denial:
reading com.android.providers.contacts.ContactsProvider uri
content://call_log/calls from pid=357, uid=10024 requ
android.permission.READ_CONTACTS
E/DatabaseUtils(  113): at
android.content.ContentProvider$Transport.enforceReadPermission(ContentProvider.java:222)
E/DatabaseUtils(  113): at
android.content.ContentProvider$Transport.bulkQuery(ContentProvider.java:115)
E/DatabaseUtils(  113): at
android.content.ContentProviderNative.onTransact(ContentProviderNative.java:97)
E/DatabaseUtils(  113): at
android.os.Binder.execTransact(Binder.java:287)
E/DatabaseUtils(  113): at dalvik.system.NativeStart.run(Native
Method)

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

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

2011-05-25 Thread Prakash Iyer
you are trying to read the contacts but have not sought the permission that
it is so nicely printing out right there...

On Wed, May 25, 2011 at 2:49 PM, Hitendrasinh Gohil 
hitendra.virtuei...@gmail.com wrote:

 E/DatabaseUtils(  113): java.lang.SecurityException: Permission Denial:
 reading com.android.providers.contacts.ContactsProvider uri
 content://call_log/calls from pid=357, uid=10024 requ
 android.permission.READ_CONTACTS
 E/DatabaseUtils(  113): at
 android.content.ContentProvider$Transport.enforceReadPermission(ContentProvider.java:222)
 E/DatabaseUtils(  113): at
 android.content.ContentProvider$Transport.bulkQuery(ContentProvider.java:115)
 E/DatabaseUtils(  113): at
 android.content.ContentProviderNative.onTransact(ContentProviderNative.java:97)
 E/DatabaseUtils(  113): at
 android.os.Binder.execTransact(Binder.java:287)
 E/DatabaseUtils(  113): at dalvik.system.NativeStart.run(Native
 Method)

 --
 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+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

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

2011-05-25 Thread Hitendrasinh Gohil
hi,

i have already set READ_CONTACT in manifest.

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en