openharmony 鸿蒙 changelogs-datashare

2023-10-30 浏览 (433)

Distributed Data Management Subsystem Changelog

cl.datashare.1 Change of the data Type in PublishedItem from Ashmem to ArrayBuffer

Change Impact

Changed the type of data in PublishedItem from Ashmem to ArrayBuffer.

PublishedItem10+

Defines the data to publish.

System capability: SystemCapability.DistributedDataManager.DataShare.Consumer

NameTypeMandatoryDescription
keystringYesKey of the data to publish.
datastring |ArrayBufferYesData to publish. If a large volume of data is to be published, use data of the ArrayBuffer type.
subscriberIdstringYesSubscriber ID.

Adaptation Guide The sample code is as follows:

Example

let arrayBuffer = new ArrayBuffer(1);
let version = 1;
let data : Array<dataShare.PublishedItem> = [{key:"key2", subscriberId:"11", data:arrayBuffer}];
function publishCallback(err, result: Array<dataShare.OperationResult>) {
    console.info("publishCallback " + JSON.stringify(result));
}
try {
    console.info("data length is:", data.length);
    dataShareHelper.publish(data, "com.acts.ohos.data.datasharetest", version, publishCallback);
} catch (e) {
    console.error("publish error " + JSON.stringify(e));
}

你可能感兴趣的鸿蒙文章

harmony 鸿蒙ArkUI Subsystem Changelog

harmony 鸿蒙Device Management Changelog

harmony 鸿蒙Distributed Data Management Subsystem Changelog

harmony 鸿蒙File Subsystem Changelog

harmony 鸿蒙Pan-sensor Subsystem Changelog

  • 所属分类: 后端技术
  • 本文标签: 软件 鸿蒙
  • 版权声明: 本文链接 https://seaxiang.com/blog/4aa0729ee1894730bd68659b181aa3b4