Android Guides | Samples

Android.Content.ContentProviderAttribute Class

Generates a /manifest/application/provider element within AndroidManifest.xml.

See Also: ContentProviderAttribute


[System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple=false, Inherited=false)]
public class ContentProviderAttribute : Attribute

See Also


The //provider element is used to declare a content provider that provides access to structured data managed by the application. The ContentProviderAttribute custom attribute is used by monodroid.exe when generating AndroidManifest.xml to to declaratively generate //provider elements.

The type this attribute is placed on must be a (possibly indirect) subclass of ContentProvider.

The following type declaration

C# Example

[ContentProvider (new[]{"com.example.Provider"}
        Label="Content Label")]
class MyContentProvider : ContentProvider {
    /* ... */

results in the following XML fragment

XML Example

<provider android:authorities="com.example.Provider"
            android:label="Content Label" />

In addition, types using the ContentProviderAttribute custom attribute can also use the GrantUriPermissionAttribute and MetaDataAttribute custom attributes to declaratively generate the nested //provider/grant-uri-permission and //provider/meta-data elements, respectively.


Namespace: Android.Content
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions:

The members of Android.Content.ContentProviderAttribute are listed below.

See Also: Attribute

Public Constructors

Constructs and initializes a new ContentProviderAttribute instance with the specified URI authorities.

Public Properties

AuthoritiesString[]. The URI authorities that identify data under the perview of the content provider.
EnabledBoolean. Whether or not the provider can be instantiated by the system.
ExportedBoolean. Whether or not the provider can be launched by components of other applications.
GrantUriPermissionsBoolean. Whether or not those who ordinarily would not have permission to access the content provider's data can be granted to do so.
IconString. An icon representing the provider.
InitOrderInt32. The order in which the content provider should be instantiated.
LabelString. A user-readable label for the provider.
MultiProcessBoolean. Whether an instance of the provider can be launched into the process of the component that started it.
NameString. The name of the class that implements the provider.
PermissionString. The name of a permission that clients must have to launch the provider.
ProcessString. The name of the process in which the activity should run.
ReadPermissionString. A permission that clients must have to query the content provider.
SyncableBoolean. Whether or not the data under the content provider's control is to be synchronized with data on a server.
WritePermissionString. A permission that clients must have to make changes to the data controlled by the content provider.