开发者

Permission denial to read from emailprovider in android

开发者 https://www.devze.com 2022-12-25 09:56 出处:网络
I\'ve problem when I want to read com.android.email.provider to get email accounts. Here is my code to re开发者_运维问答trieve the account :

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

Here is my code to re开发者_运维问答trieve 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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消