Info

syntax:

<permission android:description="string resource" android:icon="drawable resource" android:label="string resource" android:name="string" android:permissionGroup="string"

android:protectionLevel=r"normal" | "dangerous" |

"signature" | "signatureOrSystem"] />

CONTAINED IN: <manifest>

description:

Declares a security permission that can be used to limit access to specific components or features of this or other applications. See the Permissions section in the introduction, and the Security and Permissions document for more information on how permissions work.

attributes:

android:description

A user-readable description of the permission, longer and more informative than the label. It may be displayed to explain the permission to the user — for example, when the user is asked whether to grant the permission to another application.

This attribute must be set as a reference to a string resource; unlike the label attribute, it cannot be a raw string.

android:icon

A reference to a drawable resource for an icon that represents the permission.

android:label

A name for the permission, one that can be displayed to users.

As a convenience, the label can be directly set as a raw string while you're developing the application. However, when the application is ready to be published, it should be set as a reference to a string resource, so that it can be localized like other strings in the user interface.

android:name

The name of the permission. This is the name that will be used in code to refer to the permission — for example, in a <uses-permission> element and the permission attributes of application components.

The name must be unique, so it should use Java-style scoping — for example, "com.example.project.PERMITTED_ACTION".

android:permissionGroup

Assigns this permission to a group. The value of this attribute is the name of the group, which must be declared with the <permission-group> element in this or another application. If this attribute is not set, the permission does not belong to a group.

android:protectionLevel

Characterizes the potential risk implied in the permission and indicates the procedure the system should follow when determining whether or not to grant the permission to an application requesting it. The value can be set to one of the following strings:

Value

Meaning

"normal"

The default value. A lower-risk permission that gives requesting applications access to isolated application-level features, with minimal risk to other applications, the system, or the user. The system automatically grants this type of permission to a requesting application at installation, without asking for the user's explicit approval (though the user always has the option to review these permissions before installing).

"dangerous"

A higher-risk permission that would give a requesting application access to private user data or control over the device that can negatively impact the user. Because this type of permission introduces potential risk, the system may not automatically grant it to the requesting application. For example, any dangerous permissions requested by an application may be displayed to the user and require confirmation before proceeding, or some other approach may be taken to avoid the user automatically allowing the use of such facilities.

"signature"

A permission that the system grants only if the requesting application is signed with the same certificate as the application that declared the permission. If the certificates match, the system automatically grants the permission without notifying the user or asking for the user's explicit approval.

"signatureOrSystem"

A permission that the system grants only to applications that are in the Android system image or that are signed with the same certificates as those in the system image. Please avoid using this option, as the signature protection level should be sufficient for most needs and works regardless of exactly where applications are installed. The "signatureOrSystem" permission is used for certain special situations where multiple vendors have applications built into a system image and need to share specific features explicitly because they are being built together.

INTRODUCED IN: API Level 1

SEE also:

<uses-permission> <permission-tree> <permission-group>

Except as noted, this content is licensed under Apache 2.0. For details and restrictions, see the Content License. ! Go to top

Site Terms of Service - Privacy Policy - Brand Guidelines

<permission-group>

syntax:

<permission-group android:description="string resource" android:icon="drawable resource" android:label="string resource" android:name="string" />

contained in: <manifest>

description:

Declares a name for a logical grouping of related permissions. Individual permission join the group through the permissionGroup attribute of the <permission> element. Members of a group are presented together in the user interface.

Note that this element does not declare a permission itself, only a category in which permissions can be placed. See the <permission> element for element for information on declaring permissions and assigning them to groups.

attributes:

android:description

User-readable text that describes the group. The text should be longer and more explanatory than the label. This attribute must be set as a reference to a string resource. Unlike the label attribute, it cannot be a raw string.

android:icon

An icon representing the permission. This attribute must be set as a reference to a drawable resource containing the image definition.

android:label

A user-readable name for the group. As a convenience, the label can be directly set as a raw string while you're developing the application. However, when the application is ready to be published, it should be set as a reference to a string resource, so that it can be localized like other strings in the user interface.

android:name

The name of the group. This is the name that can be assigned to a <permission> element's <permissionGroup> attribute.

introduced in: API Level 1

see also:

<permission>

<permission-tree>

<uses-permission>

Except as noted, this content is licensed under Apache 2.0. For details and restrictions, see the Content License. ! Go to top

Site Terms of Service - Privacy Policy - Brand Guidelines

<permission-tree>

syntax:

<permission-tree android:icon="drawable resource" android:label="string resource" ] android:name="string" />

CONTAINED IN: <manifest>

description:

Declares the base name for a tree of permissions. The application takes ownership of all names within the tree. It can dynamically add new permissions to the tree by calling PackageManager.addPermission(). Names within the tree are separated by periods ('.'). For example, if the base name is com.example.project.taxes, permissions like the following might be added:

com.example.project.taxes.CALCULATE

com.example.project.taxes.deductions.MAKE_SOME_UP

com.example.project.taxes.deductions.EXAGGERATE

Note that this element does not declare a permission itself, only a namespace in which further permissions can be placed. See the <permission> element for information on declaring permissions.

attributes:

android:icon

An icon representing all the permissions in the tree. This attribute must be set as a reference to a drawable resource containing the image definition.

android:label

A user-readable name for the group. As a convenience, the label can be directly set as a raw string for quick and dirty programming. However, when the application is ready to be published, it should be set as a reference to a string resource, so that it can be localized like other strings in the user interface.

android:name

The name that's at the base of the permission tree. It serves as a prefix to all permission names in the tree. Java-style scoping should be used to ensure that the name is unique. The name must have more than two period-separated seqments in its path — for example, com.example.base is OK, but com.example is not.

INTRODUCED IN: API Level 1

see also:

<permission>

<permission-group>

<uses-permission>

Except as noted, this content is licensed under Apache 2.0. For details and restrictions, see the Content License. ! Go to top

Site Terms of Service - Privacy Policy - Brand Guidelines

developers

<provider>

syntax:

<provider android:

authorities="list"

android

enabled=l""true" | "false"]

android

exported=["true" | "false"!

android

qrantUriPermissions=["true" | "false"]

android

icon="drawable resource"

android

initOrder="inteqer"

android

label="string resource"

android:multiprocess=["true" | "false"]

android:

name="string"

android:

permission="strinq"

android:

process="strinq"

android:

readPermission="strinq"

android:

svncable=["true" | "false"!

android:

writePermission="strinq" >

</provider>

<application>

CONTAINED IN:

<application>

CAN CONTAIN:

<meta-data>

<qrant-uri-permission> DESCRIPTION:

Declares a content provider — a subclass of ContentProvider — that supplies structured access to data managed by the application. All content providers that are part of the application must be represented by <provider> elements in the manifest file. The system cannot see, and therefore will not run, any that are not declared. (You need to declare only those content providers that you develop as part of your application, not those developed by others that your application uses.)

The Android system identifies content providers by the authority part of a content: URI. For example, suppose that the following URI is passed to ContentResolver.queryH:

content://com.example.project.healthcareprovider/nurses/rn

The content: scheme identifies the data as belonging to a content provider and the authority (com.example.project.healthcareprovider) identifies the particular provider. The authority therefore must be unique. Typically, as in this example, it's the fully qualified name of a ContentProvider subclass. The path part of a URI may be used by a content provider to identify particular data subsets, but those paths are not declared in the manifest.

For information on using and developing content providers, see a separate document, Content Providers. attributes:

android:authorities

A list of one or more URI authorities that identify data under the purview of the content provider. Multiple authorities are listed by separating their names with a semicolon. To avoid conflicts, authority names should use a Java-style naming convention (such as com.example.provider.cartoonprovider). Typically, it's the name of the ContentProvider subclass.

There is no default. At least one authority must be specified.

android:enabled

Whether or not the content provider can be instantiated by the system — "true" if it can be, and "false" if not. The default value is "true".

The <application> element has its own enabled attribute that applies to all application components, including content providers. The <application> and <provider> attributes must both be "true" (as they both are by default) for the content provider to be enabled. If either is "false", the provider is disabled; it cannot be instantiated.

android:exported

Whether or not the content provider can be used by components of other applications — "true" if it can be, and "false" if not. If "false", the provider is available only to components of the same application or applications with the same user ID. The default value is "true".

You can export a content provider but still limit access to it with the permission attribute.

android:grantUriPermissions

Whether or not those who ordinarily would not have permission to access the content provider's data can be granted permission to do so, temporarily overcoming the restriction imposed by the readPermission, writePermission, and permission attributes — "true" if permission can be granted, and "{@ code false}" if not. If "true", permission can be granted to any of the content provider's data. If "false", permission can be granted only to the data subsets listed in <grant-uri-permission> subelements, if any. The default value is "false".

Granting permission is a way of giving an application component one-time access to data protected by a permission. For example, when an e-mail message contains an attachment, the mail application may call upon the appropriate viewer to open it, even though the viewer doesn't have general permission to look at all the content provider's data.

In such cases, permission is granted by flag_grant_read_uri_permission and flag grant write uri permission flags in the Intent object that activates the component. For example, the mail application might put flag_grant_read_uri_permission in the Intent passed to Context.startActivity(). The permission is specific to the URI in the Intent.

If you enable this feature, either by setting this attribute to "true" or by defining <grant-uri-permission> subelements, you must call Context.revokeUriPermission() when a covered URI is deleted from the provider.

See also the <grant-uri-permission> element. android:icon

An icon representing the content provider. This attribute must be set as a reference to a drawable resource containing the image definition. If it is not set, the icon specified for the application as a whole is used instead (see the <application> element's icon attribute).

android:initOrder

The order in which the content provider should be instantiated, relative to other content providers hosted by the same process. When there are dependencies among content providers, setting this attribute for each of them ensures that they are created in the order required by those dependencies. The value is a simple integer, with higher numbers being initialized first.

android:label

A user-readable label for the content provided. If this attribute is not set, the label set for the application as a whole is used instead (see the <application> element's label attribute).

The label should be set as a reference to a string resource, so that it can be localized like other strings in the user interface. However, as a convenience while you're developing the application, it can also be set as a raw string.

android:multiprocess

Whether or not an instance of the content provider can be created in every client process — "true" if instances can run in multiple processes, and "false" if not. The default value is "false".

Normally, a content provider is instantiated in the process of the application that defined it. However, if this flag is set to "true", the system can create an instance in every process where there's a client that wants to interact withit, thus avoiding the overhead of interprocess communication.

android:name

The name of the class that implements the content provider, a subclass of ContentProvider. This should be a fully qualified class name (such as, "com.example.project.TransportationProvider"). However, as a shorthand, if the first character of the name is a period, it is appended to the package name specified in the <manifest> element.

There is no default. The name must be specified. android:permission

The name of a permission that clients must have to read or write the content provider's data. This attribute is a convenient way of setting a single permission for both reading and writing. However, the readPermission and writePermission attributes take precedence over this one. If the readPermission attribute is also set, it controls access for querying the content provider. And if the writePermission attribute is set, it controls access for modifying the provider's data.

For more information on permissions, see the Permissions section in the introduction and a separate document, Security and Permissions.

android:process

The name of the process in which the content provider should run. Normally, all components of an application run in the default process created for the application. It has the same name as the application package. The <application> element's process attribute can set a different default for all components. But each component can override the default with its own process attribute, allowing you to spread your application across multiple processes.

If the name assigned to this attribute begins with a colon (':'), a new process, private to the application, is created when it's needed and the activity runs in that process. If the process name begins with a lowercase character, the activity will run in a global process of that name, provided that it has permission to do so. This allows components in different applications to share a process, reducing resource usage.

android:readPermission

A permission that clients must have to query the content provider. See also the permission and writePermission attributes.

android:syncable

Whether or not the data under the content provider's control is to be synchronized with data on a server — "true" if it is to be synchronized, and "{@ code false}" if not.

android:writePermission

A permission that clients must have to make changes to the data controlled by the content provider. See also the permission and readPermission attributes.

introduced in! API Level 1

see also!

Content Providers

t Go to top

Except as noted, this content is licensed under Apache 2.0. For details and restrictions, see the Content License. J-

Site Terms of Service - Privacy Policy - Brand Guidelines

0 0

Post a comment