diff --git a/zh-cn/application-dev/application-models/hop-multi-device-collaboration.md b/zh-cn/application-dev/application-models/hop-multi-device-collaboration.md index 53799d26dcdc87942c6a18adf193af54d976702f..69d517697d3b4fd6b23e96508060d33972597af8 100644 --- a/zh-cn/application-dev/application-models/hop-multi-device-collaboration.md +++ b/zh-cn/application-dev/application-models/hop-multi-device-collaboration.md @@ -208,8 +208,6 @@ | connectServiceExtensionAbility(want: Want, options: ConnectOptions): number; | 连接ServiceExtensionAbility。 | | disconnectServiceExtensionAbility(connection: number, callback:AsyncCallback<void>): void; | 断开连接(callback形式)。 | | disconnectServiceExtensionAbility(connection: number): Promise<void>; | 断开连接(promise形式)。 | -| stopServiceExtensionAbility(want: Want, callback: AsyncCallback<void>): void; | 退出启动的ServiceExtensionAbility,callback形式接口。 | -| stopServiceExtensionAbility(want: Want): Promise<void>; | 退出启动的ServiceExtensionAbility,Promise形式接口。 | ### 开发步骤 @@ -275,27 +273,15 @@ getRemoteDeviceId方法参照[通过跨设备启动uiability和serviceextensionability组件实现多端协同无返回数据](#通过跨设备启动uiability和serviceextensionability组件实现多端协同无返回数据)。 -5. 断开连接或退出ServiceExtensionAbility +5. 断开连接。调用disconnectServiceExtensionAbility()断开与后台服务的连接。 ```ts - // 断开与ServiceExtensionAbility的链接时,可以使用disconnectServiceExtensionAbility接口断开与后台服务的连接。 let connectionId = 1 // 在通过connectServiceExtensionAbility绑定服务时返回的Id this.context.disconnectServiceExtensionAbility(connectionId).then((data) => { console.info('disconnectServiceExtensionAbility success'); }).catch((error) => { console.error('disconnectServiceExtensionAbility failed'); }) - // 退出由connectServiceExtensionAbility接口拉起的ServiceExtensionAbility时,可以调用stopServiceExtensionAbility退出ServiceExtensionAbility - let want = { - "deviceId": getRemoteDeviceId(), - "bundleName": "com.example.myapplication", - "abilityName": "ServiceExtAbility" - }; - this.context.stopServiceExtensionAbility(want).then(() => { - console.info("stop service extension ability success") - }).catch((err) => { - console.info("stop service extension ability err is " + JSON.stringify(err)) - }) ```