Hello Everyone, I've the problem when I want to read "com.android.email.provider" to get default email account. Always have a java.lang.SecurityException: "Permission Denial: reading com.android.email.provider.EmailProvider uri content://com.android.email.provider/account from pid=429, uid=10023 requires com.android.email.permission.ACCESS_PROVIDER".
Though I've add the permission request in my manifest file: <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.test.emailaccount" android:versionCode="1" android:versionName="1.0.0" > <uses-sdk android:minSdkVersion="3" /> <uses-permission android:name="android.permission.READ_OWNER_DATA"/ > <uses-permission android:name="com.android.email.permission.ACCESS_PROVIDER"/> <application android:icon="@drawable/icon" android:label="@string/ app_name"> <activity android:name=".view.Splash" android:label="@string/ app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest> Below is my code, this test code is under Android 2.0: /** * Helper method for finding the default account. */ public static final Uri CONTENT_URI = Uri.parse("content:// com.android.email.provider/account"); /** * This projection is for searching for the default account */ public static final String RECORD_ID = "_id"; public static final String IS_DEFAULT = "isDefault"; private static final String[] DEFAULT_ID_PROJECTION = new String[] { RECORD_ID, IS_DEFAULT }; static private long getDefaultAccountWhere(Context context) { Cursor cursor = context.getContentResolver().query(CONTENT_URI, DEFAULT_ID_PROJECTION, "isDefault" + "=1", null, null); //Always throw SecurityException in this line try { if (cursor.moveToFirst()) { return cursor.getLong(0); // column 0 is id } } finally { cursor.close(); } return -1; } Actually, this code is copied from "Email Appliction" in Android 2.0 Source Code. But why it can not work in my application? Does anyone can help me? Thanks a lot! Sure -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

