harmony 鸿蒙Distributed Data Management Subsystem Changelog

  • 2023-10-30
  • 浏览 (300)

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

Name Type Mandatory Description
key string Yes Key of the data to publish.
data string |ArrayBuffer Yes Data to publish. If a large volume of data is to be published, use data of the ArrayBuffer type.
subscriberId string Yes Subscriber 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

0  赞