I searched and read android developer files but I did not find any satisfactory answer for content provider grant uri permission. Can anybody explain more detailed and more simple. My questions are: What grant uri is using for? What is the differences between grant uri permission true and false When we should use true? when false? and any more detail are appreciated.
What grant uri is using for?
The "grant Uri
permissions" feature allows you to have a ContentProvider
that is normally inaccessible by third parties, yet selectively allow access to individual Uri
values to individual third-party apps for a short period of time (e.g., long enough to view the PDF that the provider serves).
What is the differences between grant uri permission true and false
android:grantUriPermissions="true"
indicates that your Java code can use FLAG_GRANT_READ_URI_PERMISSION
and FLAG_GRANT_WRITE_URI_PERMISSION
for any Uri
served by that ContentProvider
.
android:grantUriPermissions="false"
indicates that only the Uri
values specified by child <grant-uri-permission>
elements can be used with FLAG_GRANT_READ_URI_PERMISSION
and FLAG_GRANT_WRITE_URI_PERMISSION
.