harmony 鸿蒙Performing Asset Operations in Specified User Space (for System Applications Only)
Performing Asset Operations in Specified User Space (for System Applications Only)
For a singleton application that provides system-wide management functionalities, all users share an instance, which isolates data of different users. You need to specify the user space to which the operated asset belongs when:
- The singleton application needs to store, access, and destroy assets for multiple active users.
- The singleton application needs to store an asset that is accessible after the device is first unlocked or accessible when the device is unlocked.
To implement isolation and access control of the assets for singleton applications, ASSET provides a set of APIs for asset operations with the user space specified. These APIs are available only for system applications.
Constraints
The caller must have the ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS permission.
For details about how to request the permission, see Requesting Permissions for system_basic Applications.
Available APIs
The following table describes the APIs.
API | Description | API with User Space Not Specified |
---|---|---|
addAsUser | Adds an asset to the specified user space. This API uses a promise to return the result. | add |
removeAsUser | Removes one or more assets from the specified user space. This API uses a promise to return the result. | remove |
updateAsUser | Updates an asset in the specified user space. This API uses a promise to return the result. | update |
preQueryAsUser | Performs preprocessing for the asset query in the specified user space. This API is used when user authentication is required for the access to the asset. This API must be used with queryAsUser and postQueryAsUser together. This API uses a promise to return the result. | preQuery |
queryAsUser | Queries one or more assets in the specified user space. If user authentication is required before accessing the asset, call preQueryAsUser before this API and call postQueryAsUser after this API. This API uses a promise to return the result. | query if user authentication is required before the asset is accessed. query if the asset can be accessed without user authentication. |
postQueryAsUser | Performs postprocessing for the asset query in the specified user space. This API is used when user authentication is required for the access to the asset. This API must be used with preQueryAsUser together. This API uses a promise to return the result. | postQuery |
你可能感兴趣的鸿蒙文章
harmony 鸿蒙Asset Store Kit (Asset Store Service)
harmony 鸿蒙Adding an Asset (ArkTS)
harmony 鸿蒙Managing Assets in a Group
harmony 鸿蒙Querying an Asset with User Authentication (ArkTS)
harmony 鸿蒙Querying Assets (ArkTS)
harmony 鸿蒙Removing Assets (ArkTS)
harmony 鸿蒙Updating an Asset (ArkTS)
harmony 鸿蒙Adding an Asset (C/C++)
- 所属分类: 后端技术
- 本文标签:
热门推荐
-
2、 - 优质文章
-
3、 gate.io
-
8、 golang
-
9、 openharmony
-
10、 Vue中input框自动聚焦