harmony 鸿蒙Conditional Widget Updates
Conditional Widget Updates
Form Kit provides the following methods for conditional updates:
- Network-triggered update: The widget content will be automatically updated by calling onUpdateForm when the network changes. This can be configured by setting the conditionUpdate field in the form_config.json file to network.
NOTE 1. A widget update is triggered when the device transitions from a no-network state to a connected state. However, an update is not triggered when a user switches between networks (for example, switching between different Wi-Fi networks or between Wi-Fi and cellular data) or goes from Internet connection to no Internet connection.
To minimize the frequency of widget process initiations during frequent network on/off scenarios, a no-network condition is determined after the network has been continuously unavailable for 10 minutes. Upon reconnection, a network-based update is then triggered.
This functionality is valid only for widgets of system applications.
{
"forms": [
{
"name": "UpdateDuration",
"description": "$string:widget_updateduration_desc",
"src": "./ets/updateduration/pages/UpdateDurationCard.ets",
"uiSyntax": "arkts",
"window": {
"designWidth": 720,
"autoDesignWidth": true
},
"colorMode": "auto",
"isDefault": true,
"updateEnabled": true,
"scheduledUpdateTime": "10:30",
"updateDuration": 2,
"defaultDimension": "2*2",
"supportDimensions": [
"2*2"
],
"conditionUpdate": [
"network"
]
}
]
}
你可能感兴趣的鸿蒙文章
harmony 鸿蒙Configuring Widget Configuration Files
harmony 鸿蒙Updating Widget Content by Widget Host (for System Applications Only)
harmony 鸿蒙Creating an ArkTS Widget
harmony 鸿蒙Launching the UIAbility of the Widget Provider in the Background Through the call Event
harmony 鸿蒙Overview of ArkTs Widget Page Editing Interaction
harmony 鸿蒙Editing and Updating the Widget Content
harmony 鸿蒙Updating Widget Content Through the message Event
harmony 鸿蒙Widget Event Capability Overview
harmony 鸿蒙Launching the UIAbility of the Widget Provider Through the router Event
- 所属分类: 后端技术
- 本文标签:
热门推荐
-
2、 - 优质文章
-
3、 gate.io
-
8、 golang
-
9、 openharmony
-
10、 Vue中input框自动聚焦