Pro Android with Kotlin
CHAPTER 6: Content Providers
Download 5.42 Mb. Pdf ko'rish
|
@de android telegram Pro Android with Kotlin Developing Modern Mobile
95
CHAPTER 6: Content Providers 3. Permission exemptions By using the grantUriPermission attribute of the element, you can temporarily grant permissions to components called by intent from the app that owns the content provider. If you set grantUriPermission to true and the intent for calling the other component gets constructed using the help of this: intent.addFlags( Intent.FLAG_GRANT_READ_URI_PERMISSION) /*or*/ intent.addFlags( Intent.FLAG_GRANT_WRITE_URI_PERMISSION) /*or*/ intent.addFlags( Intent.FLAG_GRANT_WRITE_URI_PERMISSION and Intent.FLAG_GRANT_READ_URI_PERMISSION) then the called component will have full access to all content of the provider. You can instead set grantUriPermission to false and add subelements. android:pathPrefix="string" /> You then control the exemptions in a more fine-grained way. For both to make sense, you obviously must have restrictions set by *permission attributes in effect; otherwise, there is nothing you can have exemptions for. The rules for the attributes are as explained earlier: path is for an exact path match, pathPrefix is for matching the start of a path, and pathPattern allows for wildcards (X* is for zero to many occurrences of any character X, and .* is for zero to many occurrences of any character). Providing Content for the Search Framework The Android search framework provides a feature to users to search any data that is available to them by whatever means and using whatever data source. We will be talking about the search framework in Chapter 8 ; for now it is important to know that content providers play a role for the following: Recent query suggestions Custom suggestions For both of them you provide special content provider subclasses and add them to AndroidManifest.xml as any other content provider. Documents Provider The documents provider is part of the Storage Access Framework (SAF). It allows for a document-centric view of data access, and it also exhibits a hierarchical super-structure of document directories. |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling