Android Manifest Component Declaration: Provider, Receiver, and Service Elements

Content Provider Declaration

The <provider> element declares a content provider component, which is a ContentProvider subclass that provides structured access to data managed by an application. All content providers must be declared in the manifest file; otherwise, the system will not recognize them and they will not execute. Only declare providers that belong to your own application.

Android identifies content providers using the authority string, which forms part of the content URI. For instance, to access a provider containing healthcare professional information, you might call ContentResolver.query() with a URI like:

content://com.example.healthcare.provider/medical_staff/physicians

The content:// scheme identifies this as an Android content provider URI. The authority com.example.healthcare.provider identifies the provider itself, and the system searches its list of known providers for this authority. The path segment medical_staff/physicians allows the provider to identify specific data subsets.

When defining a provider, include only the authority in the android:name attribute, without the scheme or path.

Attributes

  • android:authorities: Comma-separated list of URI authorities. Should follow Java naming conventions like com.example.provider.inventory. At least one authority must be specified.

  • android:enabled: Whether the system can instantiate the provider. Defaults to true. Both this and the <application> element's enabled attribute must be true for the provider to function.

  • android:directBootAware: Whether the provider can run before the user unlocks the device. During direct boot, only device-protected storage is accessible. Defaults to false.

  • android:exported: Whether other applications can access the provider. When false, only apps with the same UID or those granted temporary access via android:grantUriPermissions can interact with it. Defaults to false for API level 17+ with android:targetSdkVersion of 17 or higher.

  • android:grantUriPermissions: Allows temporary granting of access to protected data. When true, any data access can be permitted. When false, access is limited to URIs specified in <grant-uri-permission> child elements. Defaults to false.

  • android:icon, android:label: Icon and user-readable label for the provider. Falls back to application-level settings if unspecified.

  • android:initOrder: Integer specifying the order in which this provider is instantiated relative to other providers in the same process. Higher values initialize earlier.

  • android:multiprocess: When true, each app process gets its own provider instance. When false, all processes share one instance. Defaults to false. Improves performance through reduced IPC overhead but increases memory footprint.

  • android:name: Fully qualified class name of the ContentProvider subclass. Can use shorthand with leading dot to append to package name.

  • android:permission: Single permission required for both read and write operations. Overridden by readPermission and writePermission if specified.

  • android:process: Process name for the provider to run in. Names starting with : create app-private processes.

  • android:readPermission, android:writePermission: Separate permissions for query and modification operations.

  • android:syncable: Whether data controlled by the provider syncs with a server.

Broadcast Receiver Declaration

The <receiver> element declares a BroadcastReceiver component that can receive Intent broadcasts from the system or other applications, even when other application components are not running.

System awareness of broadcast receivers comes from two sources: manifest declaration using this element, or dynamic registration in code using Context.registerReceiver().

Performance consideration: Excessive broadcast receivers negatively impact application performance and device battery life. Consider using modern background work APIs instead.

Attributes

  • android:directBootAware: Indicates the receiver can operate during direct boot before device unlock. Only device-protected storage is accessible. Defaults to false.

  • android:enabled: Whether the system can instantiate the receiver. Both this and the <application> element's enabled attribute must be true. Defaults to true.

  • android:exported: Whether the receiver accepts broadcasts from external sources. Defaults to false if no intent filters are present (receiver used internally). Defaults to true if at least one intent filter exists (receiver intended for external use).

  • android:icon, android:label: Icon and label for the receiver. These also serve as defaults for the receiver's intent filters. Falls back to application-level settings if unspecified.

  • android:name: Fully qualified class name of the BroadcastReceiver subclass. Cannot be changed after publishing unless android:exported="false" is set.

  • android:permission: Permission required for broadcast senders to reach this receiver. Falls back to <application> level permission if unset.

  • android:process: Process name for the receiver to execute in. Leading : creates an app-private process.

Service Declaration

The <service> element declares a Service component, which lacks a visual interface and handles long-running background operations or provides communication APIs callable by other applications. All services must be declared in the manifest; undeclared services are not recognized or executed by the system.

Attributes

  • android:description: User-facing description of the service. Should reference a string resource for localization.

  • android:directBootAware: Weather the service operates during direct boot. Only device-protected storage is accessible. Defaults to false.

  • android:enabled: Whether the system can instantiate the service. Both this and the <application> element's enabled attribute must be true. Defaults to true.

  • android:exported: Whether other application components can call or interact with the service. When false, only same-app or same-UID components can start or bind to the service. Defaults to false without intent filters, true with intent filters.

  • android:foregroundServiceType: Specifies particular use cases like location, mediaPlayback, dataSync, connectedDevice, mediaProjection, or phoneCall. Multiple types can be assigned.

  • android:icon, android:label: Icon and display name for the service. Also serve as defaults for the service's intent filters. Falls back to application-level settings if unspecified.

  • android:isolatedProcess: When true, the service runs in an isolated process with no permissions, communicating only through the Service API via binding and starting.

  • android:name: Fully qualified class name of the Service subclass. Leading dot appends to package name. Cannot be changed after publishing unless android:exported="false" is set.

  • android:permission: Permission required for entities starting, binding to, or stopping the service. If unset, falls back to <application> level permission.

  • android:process: Process name for the service. Leading : creates an app-private process, while lowercase names use global shared processes.

Tags: Android Manifest contentprovider BroadcastReceiver Service

Posted on Sun, 04 Oct 2026 16:13:45 +0000 by Jabop