Pro Android with Kotlin


CHAPTER 6: Content Providers


Download 5.42 Mb.
Pdf ko'rish
bet64/223
Sana04.11.2023
Hajmi5.42 Mb.
#1746807
1   ...   60   61   62   63   64   65   66   67   ...   223
Bog'liq
@de android telegram Pro Android with Kotlin Developing Modern Mobile

67
CHAPTER 6: Content Providers
The URIs refer to possibly many items, or at most one item, respectively. For , use 
a globally unique name, either the reverse company domain or the package name, or a 
prominent part of it. For , use an identifier defining the table name or the data domain.
Registering the Content Provider
Once you finish the ContentProvider implementation, you must register it inside the 
AndroidManifest.xml file as follows:
android:directBootAware=["true" | "false"]
android:enabled=["true" | "false"]
android:exported=["true" | "false"]
android:grantUriPermissions=["true" | "false"]
android:icon="drawable resource"
android:initOrder="integer"
android:label="string resource"
android:multiprocess=["true" | "false"]
android:name="string"
android:permission="string"
android:process="string"
android:readPermission="string"
android:syncable=["true" | "false"]
android:writePermission="string" >
...
Table 
6-1
 describes the attributes.
Table 6-1. The
Element

Attribute (Prepend android: 
to Each)
Description
authorities
This is a semicolon-separated list of authorities. In many cases, this 
will be just one, and you usually use the app (package) name or the 
full class name of the ContentProvider implementation. There is no 
default, and you must have at least one.
directBootAware
This specifies whether the content provider can run before the user 
unlocks the device. The default is false.
enabled
This specifies whether the content provider is enabled. The default is 
true.
exported
This specifies whether other apps can access contents here. 
Depending on the architecture of your app, access might be 
restricted to components from the same app, but usually you want 
other apps to access the content and thus set this to true. Starting 
with API level 17, the default is false. Prior to that, the flag doesn’t 
exist and apps behave like this is set to true.
(continued)



Download 5.42 Mb.

Do'stlaringiz bilan baham:
1   ...   60   61   62   63   64   65   66   67   ...   223




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling