Android Guides | Samples

Android.App.ServiceAttribute Class

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

See Also: ServiceAttribute Members

Syntax

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

See Also

Remarks

The //service element is used to declare a service, which are used to implement long-running background operations or a rich communicationsAPI that can be called by other applications. The ServiceAttribute custom attribute is used by monodroid.exe when generating AndroidManifest.xml to to declaratively generate //service elements.

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

The following type declaration

C# Example

[Service (Name="mono.samples.HelloService", 
        Label="Service Label")]
class MyService : Service {
}

results in the following XML fragment:

XML Example

<service 
            android:label="Service Label" 
            android:name="mono.samples.HelloService" />

In addition, types using the ServiceAttribute custom attribute can also use the IntentFilterAttribute and MetaDataAttribute custom attributes to declaratively generate the nested //service/intent-filter and //service/meta-data elements, respectively.

Requirements

Namespace: Android.App
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0

The members of Android.App.ServiceAttribute are listed below.

See Also: Inherited members from System.Attribute

Public Constructors

Constructs and initializes a new ServiceAttribute instance.

Public Properties

Enabledbool. Whether or not the service can be instantiated by the system.
Exportedbool. Whether or not the service can be launched by components of other applications.
Iconstring. An icon representing the service.
IsolatedProcessbool.
Labelstring. A user-readable label for the service.
Namestring. The name of the class that implements the service.
Permissionstring. The name of a permission that clients must have to launch the service.
Processstring. The name of the process in which the service should run.