# @ohos.abilityConnectionManager (Cross-Device Connection Management) The **abilityConnectionManager** module provides APIs for cross-device connection management. After successful networking between devices (login with the same account and enabling of Bluetooth on the devices), a system application and a third-party application can start a [UIAbility](../apis-ability-kit/js-apis-app-ability-uiAbility.md) of the same application across these devices to establish a Bluetooth connection. This way, data (specifically, text) can be transmitted across the devices over the connection. > **NOTE** > > The initial APIs of this module are supported since API version 18. Newly added APIs will be marked with a superscript to indicate their earliest API version. ## Modules to Import ```js import { abilityConnectionManager } from '@kit.DistributedServiceKit'; ``` ## abilityConnectionManager.createAbilityConnectionSession createAbilityConnectionSession(serviceName: string, context: Context, peerInfo: PeerInfo , connectOptions: ConnectOptions): number Creates a collaboration session between applications. **System capability**: SystemCapability.DistributedSched.AppCollaboration **Parameters** | Name | Type | Mandatory | Description | | --------- | --------------------------------------- | ---- | --------- | | serviceName | string | Yes | Service name for the application. The service name must be the same on the local end and peer end. The value contains a maximum of 256 characters.| | context | [Context](../apis-ability-kit/js-apis-inner-application-context.md) | Yes| Application context.| | peerInfo | [PeerInfo](#peerinfo) | Yes | Collaboration information of the peer end.| | connectOptions | [ConnectOptions](#connectoptions) | Yes | Connection options for the application.| **Return value** | Type | Description | | ------------------- | ---------------- | | number | ID of the collaboration session.| **Error codes** For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). | ID| Error Message| | ------- | -------------------------------- | | 201 | Permission denied.| | 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. | **Example** 1. On device A, an application calls **createAbilityConnectionSession()** to create a collaboration session and return the session ID. ```ts import { abilityConnectionManager, distributedDeviceManager } from '@kit.DistributedServiceKit'; import { common } from '@kit.AbilityKit'; import { hilog } from '@kit.PerformanceAnalysisKit'; let dmClass: distributedDeviceManager.DeviceManager; function initDmClass(): void { try { dmClass = distributedDeviceManager.createDeviceManager('com.example.remotephotodemo'); } catch (err) { hilog.error(0x0000, 'testTag', 'createDeviceManager err: ' + JSON.stringify(err)); } } function getRemoteDeviceId(): string | undefined { initDmClass(); if (typeof dmClass === 'object' && dmClass !== null) { hilog.info(0x0000, 'testTag', 'getRemoteDeviceId begin'); let list = dmClass.getAvailableDeviceListSync(); if (typeof (list) === 'undefined' || typeof (list.length) === 'undefined') { hilog.info(0x0000, 'testTag', 'getRemoteDeviceId err: list is null'); return; } if (list.length === 0) { hilog.info(0x0000, 'testTag', 'getRemoteDeviceId err: list is empty'); return; } return list[0].networkId; } else { hilog.info(0x0000, 'testTag', 'getRemoteDeviceId err: dmClass is null'); return; } } const peerInfo: abilityConnectionManager.PeerInfo = { deviceId: "sinkDeviceId", bundleName: 'com.example.remotephotodemo', moduleName: 'entry', abilityName: 'EntryAbility', serviceName: 'collabTest' }; const myRecord: Record = { "newKey1": "value1", }; const options: Record = { 'ohos.collabrate.key.start.option': 'ohos.collabrate.value.foreground', }; const connectOptions: abilityConnectionManager.ConnectOptions = { needSendBigData: true, needSendStream: false, needReceiveStream: true, options: options, parameters: myRecord }; let context = getContext(this) as common.UIAbilityContext; try { this.sessionId = abilityConnectionManager.createAbilityConnectionSession("collabTest", context, peerInfo, connectOptions); hilog.info(0x0000, 'testTag', 'createSession sessionId is', this.sessionId); } catch (error) { hilog.error(0x0000, 'testTag', error); } ``` 2. On device B, **createAbilityConnectionSession** can be called in **onCollaborate**, which is triggered when the application is started. ```ts import { AbilityConstant, UIAbility, Want } from '@kit.AbilityKit'; import { abilityConnectionManager } from '@kit.DistributedServiceKit'; import { hilog } from '@kit.PerformanceAnalysisKit'; export default class EntryAbility extends UIAbility { onCollaborate(wantParam: Record): AbilityConstant.OnCollaborateResult { hilog.info(0x0000, 'testTag', '%{public}s', 'on collaborate'); let param = wantParam["ohos.extra.param.key.supportCollaborateIndex"] as Record this.onCollab(param); return 0; } onCollab(collabParam: Record) { const sessionId = this.createSessionFromWant(collabParam); if (sessionId == -1) { hilog.info(0x0000, 'testTag', 'Invalid session ID.'); return; } } createSessionFromWant(collabParam: Record): number { let sessionId = -1; const peerInfo = collabParam["PeerInfo"] as abilityConnectionManager.PeerInfo; if (peerInfo == undefined) { return sessionId; } const options = collabParam["ConnectOptions"] as abilityConnectionManager.ConnectOptions; options.needSendBigData = true; options.needSendStream = true; options.needReceiveStream = false; try { sessionId = abilityConnectionManager.createAbilityConnectionSession("collabTest", this.context, peerInfo, options); AppStorage.setOrCreate('sessionId', sessionId); hilog.info(0x0000, 'testTag', 'createSession sessionId is' + sessionId); } catch (error) { hilog.error(0x0000, 'testTag', error); } return sessionId; } } ``` ## abilityConnectionManager.destroyAbilityConnectionSession destroyAbilityConnectionSession(sessionId: number): void Destroys a collaboration session between applications. **System capability**: SystemCapability.DistributedSched.AppCollaboration **Parameters** | Name | Type | Mandatory | Description | | --------- | ---------------------------------------- | ---- | -------- | | sessionId | number | Yes | Collaboration session ID. | **Example** ```ts import { abilityConnectionManager } from '@kit.DistributedServiceKit'; import { hilog } from '@kit.PerformanceAnalysisKit'; hilog.info(0x0000, 'testTag', 'destroyAbilityConnectionSession called'); abilityConnectionManager.destroyAbilityConnectionSession(this.sessionId); ``` ## abilityConnectionManager.getPeerInfoById getPeerInfoById(sessionId: number): PeerInfo | undefined Obtains information about the peer application in the specified session. **System capability**: SystemCapability.DistributedSched.AppCollaboration **Parameters** | Name | Type | Mandatory | Description | | --------- | ---------------------------------------- | ---- | -------- | | sessionId | string | Yes | ID of the collaboration session. | **Return value** | Type | Description | | ------------------- | ---------------- | | PeerInfo | Information about the peer application.| | undefined | Unknown situation.| **Error codes** For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). | ID| Error Message| | ------- | -------------------------------- | | 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. | **Example** ```ts import { abilityConnectionManager } from '@kit.DistributedServiceKit'; import { hilog } from '@kit.PerformanceAnalysisKit'; hilog.info(0x0000, 'testTag', 'getPeerInfoById called'); const peerInfo = abilityConnectionManager.getPeerInfoById(this.sessionId); ``` ## abilityConnectionManager.connect connect(sessionId: number): Promise<ConnectResult> Sets up a UIAbility connection after a collaboration session is created and the session ID is obtained. **System capability**: SystemCapability.DistributedSched.AppCollaboration **Parameters** | Name | Type | Mandatory | Description | | --------- | --------------------------------------- | ---- | --------- | | sessionId | number | Yes | ID of the collaboration session. | **Return value** | Type | Description | | ------------------- | ---------------- | | Promise<ConnectResult> | Promise used to return the [connection result](#connectresult).| **Error codes** For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). | ID| Error Message| | ------- | -------------------------------- | | 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. | **Example** After an application sets up a collaboration session and obtains the session ID on device A, it calls **connect()** to set up a UIAbility connection and start the application on device B. ```ts import { abilityConnectionManager } from '@kit.DistributedServiceKit'; import { hilog } from '@kit.PerformanceAnalysisKit'; abilityConnectionManager.connect(this.sessionId).then((ConnectResult) => { if (!ConnectResult.isConnected) { hilog.info(0x0000, 'testTag', 'connect failed'); return; } }).catch(() => { hilog.error(0x0000, 'testTag', "connect failed"); }) ``` ## abilityConnectionManager.acceptConnect acceptConnect(sessionId: number, token: string): Promise<void> Accepts the UIAbility connection after a collaboration session is set up and the session ID is obtained. **System capability**: SystemCapability.DistributedSched.AppCollaboration **Parameters** | Name | Type | Mandatory | Description | | --------- | --------------------------------------- | ---- | ----- | | sessionId | number | Yes | ID of the collaboration session. | | token | string | Yes | Token value passed by the application on device A. | **Return value** | Type | Description | | ------------------- | ---------------- | | Promise<void> |Promise that returns no value.| **Error codes** For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). | ID| Error Message| | ------- | -------------------------------- | | 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. | **Example** After **createAbilityConnectionSession** is called on device A to create a collaboration session and the session ID is obtained, the application on device B can call **acceptConnect** to accept the connection. ```ts import { AbilityConstant, UIAbility, Want } from '@kit.AbilityKit'; import { abilityConnectionManager } from '@kit.DistributedServiceKit'; import { hilog } from '@kit.PerformanceAnalysisKit'; export default class EntryAbility extends UIAbility { onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); } onCollaborate(wantParam: Record): AbilityConstant.OnCollaborateResult { hilog.info(0x0000, 'testTag', '%{public}s', 'on collaborate'); let param = wantParam["ohos.extra.param.key.supportCollaborateIndex"] as Record this.onCollab(param); return 0; } onCollab(collabParam: Record) { const sessionId = this.createSessionFromWant(collabParam); if (sessionId == -1) { hilog.info(0x0000, 'testTag', 'Invalid session ID.'); return; } const collabToken = collabParam["ohos.dms.collabToken"] as string; abilityConnectionManager.acceptConnect(sessionId, collabToken).then(() => { hilog.info(0x0000, 'testTag', 'acceptConnect success'); }).catch(() => { hilog.error("failed"); }) } createSessionFromWant(collabParam: Record): number { let sessionId = -1; const peerInfo = collabParam["PeerInfo"] as abilityConnectionManager.PeerInfo; if (peerInfo == undefined) { return sessionId; } const options = collabParam["ConnectOptions"] as abilityConnectionManager.ConnectOptions; options.needSendBigData = true; options.needSendStream = true; options.needReceiveStream = false; try { sessionId = abilityConnectionManager.createAbilityConnectionSession("collabTest", this.context, peerInfo, options); AppStorage.setOrCreate('sessionId', sessionId); hilog.info(0x0000, 'testTag', 'createSession sessionId is' + sessionId); } catch (error) { hilog.error(0x0000, 'testTag', error); } return sessionId; } } ``` ## abilityConnectionManager.disconnect disconnect(sessionId: number): void Disconnects the UIAbility connection to end the collaboration session. **System capability**: SystemCapability.DistributedSched.AppCollaboration **Parameters** | Name | Type | Mandatory | Description | | --------- | ------------------------------------- | ---- | --------- | | sessionId | number | Yes | ID of the collaboration session. | **Example** ```ts import { abilityConnectionManager } from '@kit.DistributedServiceKit'; import { hilog } from '@kit.PerformanceAnalysisKit'; hilog.info(0x0000, 'testTag', 'disconnectRemoteAbility begin'); if (this.sessionId == -1) { hilog.info(0x0000, 'testTag', 'Invalid session ID.'); return; } abilityConnectionManager.disconnect(this.sessionId); ``` ## abilityConnectionManager.reject reject(token: string, reason: string): void; Rejects a connection requet in multi-device application collaboration. After a connection request sent from the peer application is rejected, a rejection reason is returned. **System capability**: SystemCapability.DistributedSched.AppCollaboration **Parameters** | Name | Type | Mandatory | Description | | --------- | --------------------------------------- | ---- | ----- | | token | string | Yes | Token used for application collaboration management. | | reason | string | Yes | Reason why the connection is rejected. | **Error codes** For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). | ID| Error Message| | ------- | -------------------------------- | | 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. | **Example** ```ts import { abilityConnectionManager } from '@kit.DistributedServiceKit'; import { hilog } from '@kit.PerformanceAnalysisKit'; hilog.info(0x0000, 'testTag', 'reject begin'); const collabToken = collabParam["ohos.dms.collabToken"] as string; const reason = "test"; abilityConnectionManager.reject(collabToken, reason); ``` ## abilityConnectionManager.on on(type: 'connect' | 'disconnect' | 'receiveMessage'| 'receiveData', sessionId: number, callback: Callback<EventCallbackInfo>): void Registers the callback listener for the **connect**, **disconnect**, **receiveMessage**, and **receiveData** events. **System capability**: SystemCapability.DistributedSched.AppCollaboration **Parameters** | Name | Type | Mandatory | Description | | --------- | ------------------------------------- | ---- | ----- | | type | string | Yes | Event type, which can be:
\- `connect`: event triggered when `connect()` is called.
\- `disconnect`: event is triggered when `disconnect()` is called.
\- `receiveMessage`: event triggered when `sendMessage()` is called.
\- `receiveData`: event triggered when `sendData()` is called. | | sessionId | number | Yes | ID of the collaboration session. | | callback | Callback<[EventCallbackInfo](#eventcallbackinfo)> | Yes | Registered callback function. | **Error codes** For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). | ID| Error Message| | ------- | -------------------------------- | | 201 | Permission verification failed. The application does not have the permission required to call the API.| | 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. | **Example** ```ts import { abilityConnectionManager } from '@kit.DistributedServiceKit'; import { hilog } from '@kit.PerformanceAnalysisKit'; abilityConnectionManager.on("connect", this.sessionId,(callbackInfo) => { hilog.info(0x0000, 'testTag', 'session connect, sessionId is', callbackInfo.sessionId); }); abilityConnectionManager.on("disconnect", this.sessionId,(callbackInfo) => { hilog.info(0x0000, 'testTag', 'session disconnect, sessionId is', callbackInfo.sessionId); }); abilityConnectionManager.on("receiveMessage", this.sessionId,(callbackInfo) => { hilog.info(0x0000, 'testTag', 'session receiveMessage, sessionId is', callbackInfo.sessionId); }); abilityConnectionManager.on("receiveData", this.sessionId,(callbackInfo) => { hilog.info(0x0000, 'testTag', 'session receiveData, sessionId is', callbackInfo.sessionId); }); ``` ## abilityConnectionManager.off off(type: 'connect' | 'disconnect' | 'receiveMessage'| 'receiveData', sessionId: number, callback?: Callback<EventCallbackInfo>): void Unregisters the callback listener for the **connect**, **disconnect**, **receiveMessage**, and **receiveData** events. **System capability**: SystemCapability.DistributedSched.AppCollaboration **Parameters** | Name | Type | Mandatory | Description | | --------- | ------------------------------------- | ---- | ----- | | type | string | Yes | Event type, which can be:
\- `connect`: event triggered when `connect()` is called.
\- `disconnect`: event is triggered when `disconnect()` is called.
\- `receiveMessage`: event triggered when `sendMessage()` is called.
\- `receiveData`: event triggered when `sendData()` is called. | | sessionId | number | Yes | ID of the collaboration session. | | callback | Callback<[EventCallbackInfo](#eventcallbackinfo)> | No | Registered callback function. | **Error codes** For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). | ID| Error Message| | ------- | -------------------------------- | | 201 | Permission verification failed. The application does not have the permission required to call the API.| | 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. | **Example** ```ts import { abilityConnectionManager } from '@kit.DistributedServiceKit'; import { hilog } from '@kit.PerformanceAnalysisKit'; abilityConnectionManager.off("connect", this.sessionId); abilityConnectionManager.off("disconnect", this.sessionId); abilityConnectionManager.off("receiveMessage", this.sessionId); abilityConnectionManager.off("receiveData", this.sessionId); ``` ## abilityConnectionManager.sendMessage sendMessage(sessionId: number, msg: string): Promise<void> Sends text messages after a collaboration session is set up. **System capability**: SystemCapability.DistributedSched.AppCollaboration **Parameters** | Name | Type | Mandatory | Description | | --------- | --------------------------------------- | ---- | ----- | | sessionId | number | Yes | ID of the collaboration session.| | msg | string | Yes | Text content. The maximum size of the text content is 1 KB.| **Return value** | Type | Description | | ------------------- | ---------------- | | Promise<void> | Promise that returns no value.| **Error codes** For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). | ID| Error Message| | ------- | -------------------------------- | | 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. | **Example** ```ts import { abilityConnectionManager } from '@kit.DistributedServiceKit'; import { hilog } from '@kit.PerformanceAnalysisKit'; abilityConnectionManager.sendMessage(this.sessionId, "message send success").then(() => { hilog.info(0x0000, 'testTag', "sendMessage success"); }).catch(() => { hilog.error(0x0000, 'testTag', "connect failed"); }) ``` ## abilityConnectionManager.sendData sendData(sessionId: number, data: ArrayBuffer): Promise<void> Sends [ArrayBuffer](../../arkts-utils/arraybuffer-object.md) byte streams from one device to another after a connection is successfully established. **System capability**: SystemCapability.DistributedSched.AppCollaboration **Parameters** | Name | Type | Mandatory | Description | | --------- | --------------------------------------- | ---- | ----- | | sessionId | number | Yes | ID of the collaboration session.| | data | [ArrayBuffer](../../arkts-utils/arraybuffer-object.md) | Yes | Byte stream information.| **Return value** | Type | Description | | ------------------- | ---------------- | | Promise<void> | Promise that returns no value.| **Error codes** For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). | ID| Error Message| | ------- | -------------------------------- | | 201 | Permission verification failed. The application does not have the permission required to call the API.| | 202 | Permission verification failed. A non-system application calls a system API.| | 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. | **Example** ```ts import { abilityConnectionManager } from '@kit.DistributedServiceKit'; import { hilog } from '@kit.PerformanceAnalysisKit'; let textEncoder = util.TextEncoder.create("utf-8"); const arrayBuffer = textEncoder.encodeInto("data send success"); abilityConnectionManager.sendData(this.sessionId, arrayBuffer.buffer).then(() => { hilog.info(0x0000, 'testTag', "sendMessage success"); }).catch(() => { hilog.info(0x0000, 'testTag', "sendMessage failed"); }) ``` ## PeerInfo Defines the application collaboration information. **System capability**: SystemCapability.DistributedSched.AppCollaboration | Name | Type | Readable | Writable | Mandatory | Description | | --------------------- | -------- | ---- | ---- | ---- | ------------------ | | deviceId | string | Yes | No | Yes | Peer device ID. | | bundleName | string | Yes | No | Yes | Bundle name of the application.| | moduleName | string | Yes | No | Yes | Module name of the peer application.| | abilityName | string | Yes | No | Yes | Ability name of the peer application.| | serviceName | string | Yes | No | No | Service name for the application.| ## ConnectOptions Connection options for the application. **System capability**: SystemCapability.DistributedSched.AppCollaboration | Name | Type | Readable | Writable | Mandatory | Description | | ----------- | ------- | ---- | ---- | ---- | ----------- | | needSendData | boolean | Yes | Yes | No | Whether to send data. The value **true** indicates that data needs to be sent, and the value **false** indicates the opposite. | | needSendStream | boolean | Yes | Yes | No | Whether to send streams. The value **true** indicates that streams need to be sent, and the value **false** indicates the opposite. | | needReceiveStream | boolean | Yes | Yes | No | Whether to receive streams. The value **true** indicates that streams need to be received, and the value **false** indicates the opposite. | | startOptions | [StartOptionParams](#startoptionparams) | Yes | Yes | No | Application startup options.| | parameters | Record<string, string> | Yes | Yes | No | Additional configuration for the connection. | ## ConnectResult Defines the connection result. **System capability**: SystemCapability.DistributedSched.AppCollaboration | Name | Type | Readable | Writable | Mandatory | Description | | -------- | ------ | ---- | ---- | ---- | ------- | | isConnected | boolean | Yes | No | Yes | Whether the connection is successful. The value **true** indicates that the connection is successful, and the value **false** indicates the opposite.| | errorCode | [ConnectErrorCode](#connecterrorcode) | Yes | No | No | Connection error code.| | reason | string | Yes | No | No | Connection rejection reason.| ## EventCallbackInfo Defines the event callback information. **System capability**: SystemCapability.DistributedSched.AppCollaboration | Name | Type | Readable | Writable | Description | | -------- | ------ | ---- | ---- | ----------- | | sessionId | number | Yes | Yes | Collaborative session ID.| | reason | [DisconnectReason](#disconnectreason) | Yes | No | Disconnection reason.| | msg | string | Yes | No | Received message.| | data | ArrayBuffer | Yes | No | Received byte stream.| | image | image.PixelMap | Yes | No | Received image.| ## CollaborateEventInfo Collaboration event information. **System capability**: SystemCapability.DistributedSched.AppCollaboration | Name | Type | Readable | Writable | Mandatory | Description | | -------- | ------ | ---- | ---- | ---- | ------- | | eventType | [CollaborateEventType](#collaborateeventtype) | Yes | No | Yes | Collaboration event type.| | eventMsg | string | Yes | No | No | Collaboration event message.| ## ConnectErrorCode Enumerates connection error codes. **System capability**: SystemCapability.DistributedSched.AppCollaboration | Value| Description| | -------- | -------- | | CONNECTED_SESSION_EXISTS | A session already exists between applications.| | PEER_APP_REJECTED | The peer application rejects the collaboration request.| | LOCAL_WIFI_NOT_OPEN | Wi-Fi is disabled at the local end.| | PEER_WIFI_NOT_OPEN | Wi-Fi is disabled at the peer end.| | PEER_ABILITY_NO_ONCOLLABORATE | The **onCollaborate** callback is not implemented.| ## StartOptionParams Enumerates application start options. **System capability**: SystemCapability.DistributedSched.AppCollaboration | Value| Description| | -------- | -------- | | START_IN_FOREGROUND | Start of the peer application in the foreground.| | START_IN_BACKGROUND | Start of the peer application in the background.| ## CollaborateEventType Enumerates collaboration event types. **System capability**: SystemCapability.DistributedSched.AppCollaboration | Value| Description| | -------- | -------- | | SEND_FAILURE | Task sending failure.| | COLOR_SPACE_CONVERSION_FAILURE | Color space conversion failure.| ## DisconnectReason Enumerates the disconnection reasons. **System capability**: SystemCapability.DistributedSched.AppCollaboration | Name| Value| Description| |-------|-------|-------| | PEER_APP_CLOSE_COLLABORATION | 0 |The peer application proactively disables collaboration.| | PEER_APP_EXIT | 1 |The peer application exits.| | NETWORK_DISCONNECTED | 2 |The network is disconnected.| ## CollaborationKeys Enumerates application collaboration key values. **System capability**: SystemCapability.DistributedSched.AppCollaboration | Name | Value | Description | | -------------------| ------------------------------- | ---------------------- | | PEER_INFO | ohos.collaboration.key.peerInfo | Key value of the peer device information.| | CONNECT_OPTIONS | ohos.collaboration.key.connectOptions | Key value of the connection option. | | COLLABORATE_TYPE | ohos.collaboration.key.abilityCollaborateType | Key value of the collaboration type. | ## CollaborationValues Enumerates application collaboration values. **System capability**: SystemCapability.DistributedSched.AppCollaboration | Name | Value | Description | | ----------------------------------------- | -------- | ---------------------- | | ABILITY_COLLABORATION_TYPE_DEFAULT | ohos.collaboration.value.abilityCollab | Default collaboration.| | ABILITY_COLLABORATION_TYPE_CONNECT_PROXY | ohos.collaboration.value.connectProxy | Collaboration via connection proxy. |