Hi, I am trying to query custom content provider(App A) from another 
app(App B). 

I can do that when there is no permission protection for content provider. 
Specifically, I build custom content provider on App A and sent an intent 
containing the URI to App B. Then App B get the URI and query the 
corresponding data in content provider.

Then, I add these permissions to the provider:
        <provider 
android:authorities="com.ck.contentprovider.MyContentProvider"
            android:name="com.ck.contentprovider.MyContentProvider" 
           * android:readPermission="android.permission.permRead"*
*            android:writePermission="android.permission.permWrite"*
*            android:grantUriPermissions="true"*>
        </provider>
And add this sentence to the intent so as to grant temporary access to App B
        sendIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
However, this time, when I query content provider from App B, errors occur:
        java.lang.RuntimeException: Unable to start activity 
ComponentInfo{com.android.web/com.android.web.Provid}: 
*java.lang.SecurityException: 
Permission Denial: opening     provider 
*com.ck.contentprovider.MyContentProvider 
from ProcessRecord{426c6ea8 17032:com.android.web/u0a95} (pid=17032, 
uid=10095) *requires android.permission.permRead or 
android.permission.permWrite*

It seems that App B did not make use of the temporary permission to access. 
In other word, how to utilize FLAG_GRANT_READ_URI_PERMISSION?

Thanks for attention
Jin

-- 
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

Reply via email to