ServiceAbility Configuration

Similar to a PageAbility, a ServiceAbility is configured in abilities under module of the config.json file. The difference between a ServiceAbility and PageAbility lies in the type and backgroundModes fields.

Table 1 ServiceAbility configuration items

Name Description Data Type Initial Value Allowed
type Type of the ability. The value service indicates that the ability is developed based on the Service template. String No
backgroundModes Background service type of the ability. You can assign multiple background service types to a specific ability. This field applies only to the ability using the Service template. The value can be:
dataTransfer: service for downloading, backing up, sharing, or transferring data from the network or peer devices.
audioPlayback: audio playback service.
audioRecording: audio recording service.
pictureInPicture: picture in picture (PiP) and small-window video playback services.
voip: voice/video call and VoIP services.
location: location and navigation services.
bluetoothInteraction: Bluetooth scanning, connection, and transmission services.
wifiInteraction: WLAN scanning, connection, and transmission services.
screenFetch: screen recording and screenshot services.
multiDeviceConnection: multi-device interconnection service.
String array Yes (initial value: left empty)

For details about the configuration items, see Internal Structure of module.