未验证 提交 be80ef38 编写于 作者: O openharmony_ci 提交者: Gitee

!3499 Update Docs

Merge pull request !3499 from 吴冯山/OpenHarmony-3.1-Release
......@@ -75,7 +75,7 @@ OpenHarmony系统中的分布式数据服务模块为开发者提供下面几种
backup : false,
autoSync : false,
kvStoreType : distributedData.KVStoreType.SINGLE_VERSION,
securityLevel : distributedData.SecurityLevel.S2,
securityLevel : distributedData.SecurityLevel.S0,
};
kvManager.getKVStore('storeId', options, function (err, store) {
if (err) {
......@@ -159,18 +159,21 @@ OpenHarmony系统中的分布式数据服务模块为开发者提供下面几种
deviceManager.createDeviceManager("bundleName", (err, value) => {
if (!err) {
devManager = value;
// get deviceIds
let deviceIds = [];
if (devManager != null) {
var devices = devManager.getTrustedDeviceListSync();
for (var i = 0; i < devices.length; i++) {
deviceIds[i] = devices[i].deviceId;
}
}
try{
kvStore.sync(deviceIds, distributedData.SyncMode.PUSH_ONLY, 1000);
}catch (e) {
console.log("An unexpected error occurred. Error:" + e);
}
}
});
// get deviceIds
let deviceIds = [];
if (devManager != null) {
var deviceList = devManager.getTrustedDeviceListSync();
for (var i = 0; i < deviceList.length; i++) {
deviceIds[i] = deviceList[i].deviceId;
}
}
kvStore.sync(deviceIds, distributedData.SyncMode.PUSH_ONLY, 1000);
```
## 相关实例
针对分布式数据开发,有以下相关实例可供参考:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册