Read the original article:Creating and Configuring SysCap File for Wearables
Creating and Configuring SysCap File for Wearables
Requirement Description
Wearable apps require correct SysCap configuration to access supported system features and avoid build errors.
Background Knowledge
SysCap (System Capability) defines which system APIs are available.
Implementation Steps
Create entry/src/main/syscap.json
Enter the required SysCaps in the following format. The following is an example of the syscap.json file for using the FileIO capability
{
"devices": {
"general": [
// Each typical device corresponds to a SysCap set. Multiple typical devices can be configured. The devices must be the same as those selected in the project.
"phone"
]
},
"development": {
// The SysCap set in addedSysCaps and the SysCap set supported by each device configured in devices form the associated SysCap set.
"addedSysCaps": [
"SystemCapability.FileManagement.File.FileIO",
]
}
}
Limitation or Considerations
Unsupported SysCaps cause build failure. Use canIUse() defined by the system to check whether a SysCap is supported.
if (canIUse("SystemCapability.ArkUI.ArkUI.Full")) {
console.log("This device supports SystemCapability.ArkUI.ArkUI.Full.");
} else {
console.log("This device does not support SystemCapability.ArkUI.ArkUI.Full.");
}
Related Documents or Links
https://developer.huawei.com/consumer/en/doc/harmonyos-references-V5/syscap-V5


Top comments (0)