harmony 鸿蒙ServiceAbility Component Configuration

  • 2023-02-03
  • 浏览 (414)

ServiceAbility Component 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.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Application Models

harmony 鸿蒙Using Explicit Want to Start an Application Component

harmony 鸿蒙Using Implicit Want to Open a Website

harmony 鸿蒙AbilityStage Component Container

harmony 鸿蒙Accessing a DataAbility

harmony 鸿蒙Accessing a DataShareExtensionAbility from the FA Model

harmony 鸿蒙AccessibilityExtensionAbility

harmony 鸿蒙Common action and entities Values

harmony 鸿蒙API Switching Overview

harmony 鸿蒙Switching of app and deviceConfig

0  赞