From 2afa84bfb0e3341f8c1f6a1a3007845b1b670a86 Mon Sep 17 00:00:00 2001 From: fangJinliang1 Date: Fri, 16 Dec 2022 15:43:35 +0800 Subject: [PATCH] add wantAgent changelog Signed-off-by: fangJinliang1 Change-Id: I3338723cc2937b9cc08a5fc60f513a9b3543ec5f --- .../changelogs-wantAgent.md | 90 +++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 zh-cn/release-notes/changelogs/OpenHarmony_3.2.9.1/changelogs-wantAgent.md diff --git a/zh-cn/release-notes/changelogs/OpenHarmony_3.2.9.1/changelogs-wantAgent.md b/zh-cn/release-notes/changelogs/OpenHarmony_3.2.9.1/changelogs-wantAgent.md new file mode 100644 index 0000000000..468cdd16e5 --- /dev/null +++ b/zh-cn/release-notes/changelogs/OpenHarmony_3.2.9.1/changelogs-wantAgent.md @@ -0,0 +1,90 @@ +# wantAgent的JS API变更Changelog + +OpenHarmony 3.2.9.1 sp8版本相较于OpenHarmony 3.2.8.1版本,wantAgent的API变更如下 + +## cl.url.1.trigger类接口变更 +trigger(agent: WantAgent, triggerInfo: TriggerInfo, callback?: Callback): void ; + +因部分功能未实现,已对其进行删除,应用可调用下面接口进行替代: + + trigger(agent: WantAgent, triggerInfo: TriggerInfo, callback?: AsyncCallback): void + + **变更影响** + +影响已发布的JS接口,应用需要进行适配,才可以在新版本SDK环境正常编译通过。 + +**关键的接口/组件变更** + +| OpenHarmony 3.2.8.1版本接口 | OpenHarmony 3.2.9.1 sp8版本接口 | +| ------------------------------------------------------------ | ------------------------------------------------------------ | +| trigger(agent: WantAgent, triggerInfo: TriggerInfo, callback?: Callback): void ; | trigger(agent: WantAgent, triggerInfo: TriggerInfo, callback?: AsyncCallback): void | + +**适配指导** + +应用中调用替代的trigger接口可参考下列代码 + +示例: + +```ts +import WantAgent from '@ohos.app.ability.wantAgent'; +//wantAgent对象 +var wantAgent; +// triggerInfo +var triggerInfo = { + code: 0 + } +//WantAgentInfo对象 +var wantAgentInfo = { + wants: [ + { + deviceId: "deviceId", + bundleName: "com.neu.setResultOnAbilityResultTest1", + abilityName: "com.example.test.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + parameters: + { + mykey0: 2222, + mykey1: [1, 2, 3], + mykey2: "[1, 2, 3]", + mykey3: "ssssssssssssssssssssssssss", + mykey4: [false, true, false], + mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], + mykey6: true, + } + } + ], + operationType: WantAgent.OperationType.START_ABILITIES, + requestCode: 0, + wantAgentFlags:[WantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] +} + +//getWantAgent回调 +function getWantAgentCallback(err, data) { + if (err == undefined) { + wantAgent = data; + } else { + console.info('getWantAgent failed' + JSON.stringify(wantAgent)); + } + //getUid回调 + function triggerCallback(err, data) { + if(err) { + console.info('getUid failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); + } else { + console.info('getUid ok!' + JSON.stringify(data)); + } + } + try { + WantAgent.trigger(wantAgent, triggerInfo, triggerCallback); + } catch(err) { + console.info('getUid failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); + } +} +try{ + WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); +} catch(err){ + console.info('getWantAgent failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); +} +``` -- GitLab