Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Permission denial to read from emailprovider in android

I've problem when I want to read com.android.email.provider to get email accounts.

Here is my code to retrieve the account :

Cursor c = null;
Uri CONTENT_URI = Uri.parse("content://com.android.email.provider/account");
String RECORD_ID = "_id";
String[] ID_PROJECTION = new String[] {RECORD_ID };        
c = getContentResolver().query(CONTENT_URI,ID_PROJECTION,null, null, null);   

I got a security exception:

java.lang.SecurityException: Permission Denial: reading com.android.email.provider.EmailProvider uri content://com.android.email.provider/account from pid=278, uid=10003 requires com.android.email.permission.ACCESS_PROVIDER

I want to know the account is created or not in some other app. Is there any other way to resolve this so that I can read from the provider.

I have also tried adding the permission in manifest:

<uses-permission android:name="com.android.email.permission.ACCESS_PROVIDER"/>

That didn't help.

Any solution would be greatly appreciated.

Thanks in advance

like image 592
Ambika Avatar asked Nov 14 '22 11:11

Ambika


1 Answers

I'm afraid, it's impossible. See, here http://androidbridge.blogspot.com/2011/03/reading-emails-in-android.html

like image 88
Przemysław Różycki Avatar answered Dec 26 '22 20:12

Przemysław Różycki