未验证 提交 f506f847 编写于 作者: 江海 提交者: Gitee

Description: Fix ota demo

Signed-off-by: 江海<jianghai14@huawei.com>
https://gitee.com/openharmony/docs/issues/I5H68B
上级 9aefa849
...@@ -339,7 +339,7 @@ var versionDigestInfo = { ...@@ -339,7 +339,7 @@ var versionDigestInfo = {
// 下载选项 // 下载选项
var downloadOptions = { var downloadOptions = {
allowNetwork: update.NetType.CELLULAR_AND_WIFI, // 允许所有网络下载 allowNetwork: update.NetType.CELLULAR, // 允许数据网络下载
order: update.Order.DOWNLOAD // 下载 order: update.Order.DOWNLOAD // 下载
} }
updater.download(versionDigestInfo, downloadOptions, (err) => { updater.download(versionDigestInfo, downloadOptions, (err) => {
...@@ -380,7 +380,7 @@ var versionDigestInfo = { ...@@ -380,7 +380,7 @@ var versionDigestInfo = {
// 下载选项 // 下载选项
var downloadOptions = { var downloadOptions = {
allowNetwork: update.NetType.CELLULAR_AND_WIFI, // 允许所有网络下载 allowNetwork: update.NetType.CELLULAR, // 允许数据网络下载
order: update.Order.DOWNLOAD // 下载 order: update.Order.DOWNLOAD // 下载
} }
updater.download(versionDigestInfo, downloadOptions).then(() => { updater.download(versionDigestInfo, downloadOptions).then(() => {
...@@ -418,7 +418,7 @@ var versionDigestInfo = { ...@@ -418,7 +418,7 @@ var versionDigestInfo = {
// 恢复下载选项 // 恢复下载选项
var resumeDownloadOptions = { var resumeDownloadOptions = {
allowNetwork: update.NetType.CELLULAR_AND_WIFI, // 允许所有网络下载 allowNetwork: update.NetType.CELLULAR, // 允许数据网络下载
} }
updater.resumeDownload(versionDigestInfo, resumeDownloadOptions, (err) => { updater.resumeDownload(versionDigestInfo, resumeDownloadOptions, (err) => {
console.log(`resumeDownload error ${JSON.stringify(err)}`); console.log(`resumeDownload error ${JSON.stringify(err)}`);
...@@ -458,7 +458,7 @@ var versionDigestInfo = { ...@@ -458,7 +458,7 @@ var versionDigestInfo = {
// 恢复下载选项 // 恢复下载选项
var resumeDownloadOptions = { var resumeDownloadOptions = {
allowNetwork: update.NetType.CELLULAR_AND_WIFI, // 允许所有网络下载 allowNetwork: update.NetType.CELLULAR, // 允许数据网络下载
} }
updater.resumeDownload(versionDigestInfo, resumeDownloadOptions).then(value => { updater.resumeDownload(versionDigestInfo, resumeDownloadOptions).then(value => {
console.log(`resumeDownload start`); console.log(`resumeDownload start`);
...@@ -773,7 +773,7 @@ setUpgradePolicy(policy: UpgradePolicy, callback: AsyncCallback\<number>): void ...@@ -773,7 +773,7 @@ setUpgradePolicy(policy: UpgradePolicy, callback: AsyncCallback\<number>): void
let policy = { let policy = {
downloadStrategy: false, downloadStrategy: false,
autoUpgradeStrategy: false, autoUpgradeStrategy: false,
autoUpgradeInterval: [ 120, 240 ], // 自动升级时间段,用分钟表示 autoUpgradePeriods: [ { start: 120, end: 240 } ] // 自动升级时间段,用分钟表示
} }
updater.setUpgradePolicy(policy, (err, value) => { updater.setUpgradePolicy(policy, (err, value) => {
console.log(`setUpgradePolicy result: ${value?}`); console.log(`setUpgradePolicy result: ${value?}`);
...@@ -808,11 +808,11 @@ setUpgradePolicy(policy: UpgradePolicy): Promise\<number> ...@@ -808,11 +808,11 @@ setUpgradePolicy(policy: UpgradePolicy): Promise\<number>
let policy = { let policy = {
downloadStrategy: false, downloadStrategy: false,
autoUpgradeStrategy: false, autoUpgradeStrategy: false,
autoUpgradeInterval: [ 120, 240 ], // 自动升级时间段,用分钟表示 autoUpgradePeriods: [ { start: 120, end: 240 } ] // 自动升级时间段,用分钟表示
} }
updater.setUpgradePolicy(policy).then(result => updater.setUpgradePolicy(policy).then(result => {
console.log(`setUpgradePolicy &{result}`); console.log(`setUpgradePolicy &{result}`);
).catch(err => { }).catch(err => {
console.log(`setUpgradePolicy promise error ${JSON.stringify(err)}`); console.log(`setUpgradePolicy promise error ${JSON.stringify(err)}`);
}); });
``` ```
...@@ -1095,7 +1095,7 @@ applyNewVersion(upgradeFiles: Array<[UpgradeFile](#upgradefile)>): Promise\<void ...@@ -1095,7 +1095,7 @@ applyNewVersion(upgradeFiles: Array<[UpgradeFile](#upgradefile)>): Promise\<void
``` ```
var upgradeFiles = [{ var upgradeFiles = [{
fileType: update.update.ComponentType.OTA, // OTA包 fileType: update.ComponentType.OTA, // OTA包
filePath: "path" // 本地升级包路径 filePath: "path" // 本地升级包路径
}] }]
localUpdater.applyNewVersion(upgradeFiles).then(() => { localUpdater.applyNewVersion(upgradeFiles).then(() => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册