Permission to refuse to read from emailprovider in android

I have a problem when I want to read com.android.email.providerbefore receiving 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 if an account is created or not in another application. Is there any other way to resolve this so that I can read with the provider.

I also tried adding permission to the manifest:

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

It did not help.

It would be helpful to get any solution.

Thanks in advance

+5
source share
1 answer

All Articles