AI2 Component  (Version nb184)
com.google.appinventor.components.annotations.androidmanifest.ProviderElement Interface Reference

Public Member Functions

MetaDataElement[] metaDataElements () default
 
PathPermissionElement[] pathPermissionElement () default
 
GrantUriPermissionElement[] grantUriPermissionElement () default
 
String authorities ()
 
String enabled () default ""
 
String directBootAware () default "false"
 
String exported () default ""
 
String grantUriPermissions () default ""
 
String icon () default ""
 
String initOrder () default ""
 
String label () default ""
 
String multiprocess () default ""
 
String name ()
 
String permission () default ""
 
String process () default ""
 
String readPermission () default ""
 
String syncable () default ""
 
String writePermission () default ""
 

Detailed Description

Annotation to describe a <provider> element required by a component so that it can be added to AndroidManifest.xml. <provider> elements indicate that a component is a content provider. <provider> element attributes that are not set explicitly default to "" or {} and are ignored when the element is created in the manifest.

Note: Most of this documentation is adapted from the Android framework specification linked below. That documentation is licensed under the ahref="https://creativecommons.org/licenses/by/2.5/">CreativeCommonsAttributionlicensev2.5</a>.See@link<ahref="https://developer.android.com/guide/topics/manifest/provider-element">https://developer.android.com/guide/topics/manifest/provider-element</a>.@authorhttps://github.com/ShreyashSaitwal(ShreyashSaitwal)

Definition at line 35 of file ProviderElement.java.

Member Function Documentation

◆ authorities()

String com.google.appinventor.components.annotations.androidmanifest.ProviderElement.authorities ( )

A list of one or more URI authorities that identify data offered by 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 that implements the provider

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

Returns
the provider authorities attribute

◆ directBootAware()

String com.google.appinventor.components.annotations.androidmanifest.ProviderElement.directBootAware ( )

Whether or not the content provider is direct-boot aware; that is, whether or not it can run before the user unlocks the device.

The default value is "false".

Returns
the provider directBootAware attribute

◆ enabled()

String com.google.appinventor.components.annotations.androidmanifest.ProviderElement.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.

Returns
the provider enabled attribute

◆ exported()

String com.google.appinventor.components.annotations.androidmanifest.ProviderElement.exported ( )

Whether the content provider is available for other applications to use:

  • true: The provider is available to other applications. Any application can use the provider's content URI to access it, subject to the permissions specified for the provider.
  • false: The provider is not available to other applications. Set android:exported="false" to limit access to the provider to your applications. Only applications that have the same user ID (UID) as the provider, or applications that have been temporarily granted access to the provider through the android:grantUriPermissions element, have access to it.

Because this attribute was introduced in API level 17, all devices running API level 16 and lower behave as though this attribute is set "true". If you set android:targetSdkVersion to 17 or higher, then the default value is "false" for devices running API level 17 and higher.

You can set android:exported="false" and still limit access to your provider by setting permissions with the permission() attribute.

Returns
the provider exported attribute

◆ grantUriPermissionElement()

GrantUriPermissionElement [] com.google.appinventor.components.annotations.androidmanifest.ProviderElement.grantUriPermissionElement ( )

An array containing any path permissions used by this <provider> element.

Returns
an array containing the <path-permission> subelements for this <provider> element

Definition at line 59 of file ProviderElement.java.

◆ grantUriPermissions()

String com.google.appinventor.components.annotations.androidmanifest.ProviderElement.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, permission, and exported attributes — "true" if permission can be granted, and "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 GrantUriPermissionElement.

Returns
the provider grantUriPermission attribute

◆ icon()

String com.google.appinventor.components.annotations.androidmanifest.ProviderElement.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.

Returns
the provider icon attribute

◆ initOrder()

String com.google.appinventor.components.annotations.androidmanifest.ProviderElement.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.

Returns
the provider initOrder attribute

◆ label()

String com.google.appinventor.components.annotations.androidmanifest.ProviderElement.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.

Returns
the provider label attribute

◆ metaDataElements()

MetaDataElement [] com.google.appinventor.components.annotations.androidmanifest.ProviderElement.metaDataElements ( )

An array containing any meta data used by this <provider> element.

Returns
an array containing the <meta-data> subelements for this <provider> element

Definition at line 43 of file ProviderElement.java.

◆ multiprocess()

String com.google.appinventor.components.annotations.androidmanifest.ProviderElement.multiprocess ( )

If the app runs in multiple processes, this attribute determines whether multiple instances of the content provider are created. If true, each of the app's processes has its own content provider object. If false, the app's processes share only one content provider object. The default value is false. Setting this flag to true may improve performance by reducing the overhead of interprocess communication, but it also increases the memory footprint of each process.

Returns
the provider multiprocess attribute

◆ name()

String com.google.appinventor.components.annotations.androidmanifest.ProviderElement.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.

Returns
the provider class name

◆ pathPermissionElement()

PathPermissionElement [] com.google.appinventor.components.annotations.androidmanifest.ProviderElement.pathPermissionElement ( )

An array containing any path permissions used by this <provider> element.

Returns
an array containing the <path-permission> subelements for this <provider> element

Definition at line 51 of file ProviderElement.java.

◆ permission()

String com.google.appinventor.components.annotations.androidmanifest.ProviderElement.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(), writePermission(), and grantUriPermissions() 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.

Returns
the provider permission attribute

◆ process()

String com.google.appinventor.components.annotations.androidmanifest.ProviderElement.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.

Returns
the provider process attribute

◆ readPermission()

String com.google.appinventor.components.annotations.androidmanifest.ProviderElement.readPermission ( )

A permission that clients must have to query the content provider.

If the provider sets android:grantUriPermissions to true, or if a given client satisfies the conditions of a <grant-uri-permission> subelement, the client can gain temporary read access to the content provider's data.

See also the permission() and writePermission() attributes.

Returns
the provider readPermission attribute

◆ syncable()

String com.google.appinventor.components.annotations.androidmanifest.ProviderElement.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 "false" if not.

Returns
the provider syncable attribute

◆ writePermission()

String com.google.appinventor.components.annotations.androidmanifest.ProviderElement.writePermission ( )

A permission that clients must have to make changes to the data controlled by the content provider.

If the provider sets android:grantUriPermissions to true, or if a given client satisfies the conditions of a <grant-uri-permission> subelement, the client can gain temporary write access to modify the content provider's data.

See also the permission() and readPermission() attributes.

Returns

The documentation for this interface was generated from the following file: