1# @ohos.distributedMissionManager (Distributed Mission Management) 2 3The **distributedMissionManager** module implements mission management across devices. You can use the APIs provided by this module to register or deregister a mission status listener, start or stop synchronizing a remote mission list, and continue a mission on a remote device by mission ID or bundle name. 4 5> **NOTE** 6> 7> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. 8> 9> The APIs provided by this module are system APIs. 10 11## Modules to Import 12 13```js 14import distributedMissionManager from '@ohos.distributedMissionManager' 15``` 16 17## distributedMissionManager.registerMissionListener 18 19registerMissionListener(parameter: MissionDeviceInfo, options: MissionCallback, callback: AsyncCallback<void>): void; 20 21Registers a mission status listener. This API uses an asynchronous callback to return the result. 22 23**Required permissions**: ohos.permission.MANAGE_MISSIONS 24 25**System capability**: SystemCapability.Ability.AbilityRuntime.Mission 26 27**Parameters** 28 29| Name | Type | Mandatory | Description | 30| --------- | --------------------------------------- | ---- | --------- | 31| parameter | [MissionDeviceInfo](#missiondeviceinfo) | Yes | Information about the device to listen for.| 32| options | [MissionCallback](#missioncallback) | Yes | Callback to register.| 33| callback | AsyncCallback<void> | Yes | Callback used to return the result. If the listener is registered, **err** is **undefined**. Otherwise, **err** is an error object.| 34 35**Example** 36 37 ```ts 38 import distributedMissionManager from '@ohos.distributedMissionManager' 39 import { BusinessError } from '@ohos.base'; 40 function NotifyMissionsChanged(deviceId: string): void { 41 console.log('NotifyMissionsChanged deviceId ' + JSON.stringify(deviceId)); 42 } 43 function NotifySnapshot(deviceId: string, missionId: number): void { 44 console.log('NotifySnapshot deviceId ' + JSON.stringify(deviceId)); 45 console.log('NotifySnapshot missionId ' + JSON.stringify(missionId)); 46 } 47 function NotifyNetDisconnect(deviceId: string, state: number): void { 48 console.log('NotifyNetDisconnect deviceId ' + JSON.stringify(deviceId)); 49 console.log('NotifyNetDisconnect state ' + JSON.stringify(state)); 50 } 51 try { 52 distributedMissionManager.registerMissionListener( 53 { deviceId: "" }, 54 { 55 notifyMissionsChanged: NotifyMissionsChanged, 56 notifySnapshot: NotifySnapshot, 57 notifyNetDisconnect: NotifyNetDisconnect 58 }, 59 (error: BusinessError) => { 60 if (error.code != 0) { 61 console.error('registerMissionListener failed, cause: ' + JSON.stringify(error)) 62 } 63 console.info('registerMissionListener finished') 64 }); 65 } catch (error) { 66 console.error('registerMissionListener failed, cause: ' + JSON.stringify(error)) 67 } 68 ``` 69## distributedMissionManager.registerMissionListener 70 71registerMissionListener(parameter: MissionDeviceInfo, options: MissionCallback): Promise<void> 72 73Registers a mission status listener. This API uses a promise to return the result. 74 75**Required permissions**: ohos.permission.MANAGE_MISSIONS 76 77**System capability**: SystemCapability.Ability.AbilityRuntime.Mission 78 79**Parameters** 80 81| Name | Type | Mandatory | Description | 82| --------- | ---------------------------------------- | ---- | -------- | 83| parameter | [MissionDeviceInfo](#missiondeviceinfo) | Yes | Information about the device to listen for. | 84| options | <a href="#missioncallback">MissionCallback</a> | Yes | Callback to register.| 85 86**Return value** 87 88| Type | Description | 89| ------------------- | ---------------- | 90| Promise<void> | Promise that returns no value.| 91 92**Example** 93 94 ```ts 95 import distributedMissionManager from '@ohos.distributedMissionManager' 96 import { BusinessError } from '@ohos.base'; 97 function NotifyMissionsChanged(deviceId: string): void { 98 console.log('NotifyMissionsChanged deviceId ' + JSON.stringify(deviceId)); 99 } 100 function NotifySnapshot(deviceId: string, missionId: number): void { 101 console.log('NotifySnapshot deviceId ' + JSON.stringify(deviceId)); 102 console.log('NotifySnapshot missionId ' + JSON.stringify(missionId)); 103 } 104 function NotifyNetDisconnect(deviceId: string, state: number): void { 105 console.log('NotifyNetDisconnect deviceId ' + JSON.stringify(deviceId)); 106 console.log('NotifyNetDisconnect state ' + JSON.stringify(state)); 107 } 108 try { 109 distributedMissionManager.registerMissionListener( 110 { deviceId: "" }, 111 { 112 notifyMissionsChanged: NotifyMissionsChanged, 113 notifySnapshot: NotifySnapshot, 114 notifyNetDisconnect: NotifyNetDisconnect 115 }).then((data: void) => { 116 console.info('registerMissionListener finished, ' + JSON.stringify(data)); 117 }).catch((error: BusinessError) => { 118 console.error('registerMissionListener failed, cause: ' + JSON.stringify(error)); 119 }) 120 } catch (error) { 121 console.error('registerMissionListener failed, cause: ' + JSON.stringify(error)) 122 } 123 ``` 124 125## distributedMissionManager.unRegisterMissionListener 126 127unRegisterMissionListener(parameter: MissionDeviceInfo, callback: AsyncCallback<void>): void; 128 129Deregisters a mission status listener. This API uses an asynchronous callback to return the result. 130 131**Required permissions**: ohos.permission.MANAGE_MISSIONS 132 133**System capability**: SystemCapability.Ability.AbilityRuntime.Mission 134 135**Parameters** 136 137| Name | Type | Mandatory | Description | 138| --------- | --------------------------------------- | ---- | --------- | 139| parameter | [MissionDeviceInfo](#missiondeviceinfo) | Yes | Information about the device to listen for. | 140| callback | AsyncCallback<void> | Yes | Callback used to return the result. If the listener is deregistered, **err** is **undefined**. Otherwise, **err** is an error object.| 141 142**Example** 143 144 ```ts 145 import distributedMissionManager from '@ohos.distributedMissionManager' 146 import { BusinessError } from '@ohos.base'; 147 try { 148 distributedMissionManager.unRegisterMissionListener( 149 { deviceId: "" }, 150 (error: BusinessError) => { 151 if (error.code != 0) { 152 console.error('unRegisterMissionListener failed, cause: ' + JSON.stringify(error)) 153 } 154 console.info('unRegisterMissionListener finished') 155 }) 156 } catch (error) { 157 console.error('unRegisterMissionListener failed, cause: ' + JSON.stringify(error)) 158 } 159 ``` 160 161## distributedMissionManager.unRegisterMissionListener 162 163unRegisterMissionListener(parameter: MissionDeviceInfo): Promise<void> 164 165Deregisters a mission status listener. This API uses a promise to return the result. 166 167**Required permissions**: ohos.permission.MANAGE_MISSIONS 168 169**System capability**: SystemCapability.Ability.AbilityRuntime.Mission 170 171**Parameters** 172 173| Name | Type | Mandatory | Description | 174| --------- | --------------------------------------- | ---- | ----- | 175| parameter | [MissionDeviceInfo](#missiondeviceinfo) | Yes | Information about the device to listen for.| 176 177**Return value** 178 179| Type | Description | 180| ------------------- | ---------------- | 181| Promise<void> |Promise that returns no value.| 182 183**Example** 184 185 ```ts 186 import distributedMissionManager from '@ohos.distributedMissionManager' 187 import { BusinessError } from '@ohos.base'; 188 try { 189 distributedMissionManager.unRegisterMissionListener({deviceId: ""}).then(() => { 190 console.info('unRegisterMissionListener finished successfully'); 191 }).catch((error: BusinessError) => { 192 console.error('unRegisterMissionListener failed, cause: ' + JSON.stringify(error)); 193 }) 194 } catch (error) { 195 console.error('unRegisterMissionListener failed, cause: ' + JSON.stringify(error)) 196 } 197 ``` 198 199## distributedMissionManager.startSyncRemoteMissions 200 201startSyncRemoteMissions(parameter: MissionParameter, callback: AsyncCallback<void>): void; 202 203Starts to synchronize the remote mission list. This API uses an asynchronous callback to return the result. 204 205**Required permissions**: ohos.permission.MANAGE_MISSIONS 206 207**System capability**: SystemCapability.Ability.AbilityRuntime.Mission 208 209**Parameters** 210 211| Name | Type | Mandatory | Description | 212| --------- | ------------------------------------- | ---- | --------- | 213| parameter | [MissionParameter](#missionparameter) | Yes | Parameters required for synchronization. | 214| callback | AsyncCallback<void> | Yes | Callback used to return the result. If the synchronization is started, **err** is **undefined**. Otherwise, **err** is an error object.| 215 216**Example** 217 218 ```ts 219 import distributedMissionManager from '@ohos.distributedMissionManager' 220 import { BusinessError } from '@ohos.base'; 221 try { 222 distributedMissionManager.startSyncRemoteMissions( 223 { 224 deviceId: "", 225 fixConflict: false, 226 tag: 0 227 }, 228 (error: BusinessError) => { 229 if (error.code != 0) { 230 console.error('startSyncRemoteMissions failed, cause: ' + JSON.stringify(error)) 231 } 232 console.info('startSyncRemoteMissions finished')} 233 ) 234 } catch (error) { 235 console.error('startSyncRemoteMissions failed, cause: ' + JSON.stringify(error)) 236 } 237 ``` 238 239## distributedMissionManager.startSyncRemoteMissions 240 241startSyncRemoteMissions(parameter: MissionParameter): Promise<void> 242 243Starts to synchronize the remote mission list. This API uses a promise to return the result. 244 245**Required permissions**: ohos.permission.MANAGE_MISSIONS 246 247**System capability**: SystemCapability.Ability.AbilityRuntime.Mission 248 249**Parameters** 250 251| Name | Type | Mandatory | Description | 252| --------- | ------------------------------------- | ---- | ----- | 253| parameter | [MissionParameter](#missionparameter) | Yes | Parameters required for synchronization.| 254 255**Return value** 256 257| Type | Description | 258| ------------------- | ---------------- | 259| Promise<void> | Promise that returns no value.| 260 261**Example** 262 263 ```ts 264 import distributedMissionManager from '@ohos.distributedMissionManager' 265 import { BusinessError } from '@ohos.base'; 266 try { 267 distributedMissionManager.startSyncRemoteMissions( 268 { 269 deviceId: "", 270 fixConflict: false, 271 tag: 0 272 } 273 ).then(() => { 274 console.info('startSyncRemoteMissions finished successfully'); 275 }).catch((error: BusinessError) => { 276 console.error('startSyncRemoteMissions failed, cause: ' + JSON.stringify(error)); 277 }) 278 } catch (error) { 279 console.error('startSyncRemoteMissions failed, cause: ' + JSON.stringify(error)) 280 } 281 ``` 282 283## distributedMissionManager.stopSyncRemoteMissions 284 285stopSyncRemoteMissions(parameter: MissionDeviceInfo, callback: AsyncCallback<void>): void; 286 287Stops synchronizing the remote mission list. This API uses an asynchronous callback to return the result. 288 289**Required permissions**: ohos.permission.MANAGE_MISSIONS 290 291**System capability**: SystemCapability.Ability.AbilityRuntime.Mission 292 293**Parameters** 294 295| Name | Type | Mandatory | Description | 296| --------- | --------------------------------------- | ---- | --------- | 297| parameter | [MissionDeviceInfo](#missiondeviceinfo) | Yes | Parameters required for synchronization. | 298| callback | AsyncCallback<void> | Yes | Callback used to return the result. If the synchronization is stopped, **err** is **undefined**. Otherwise, **err** is an error object.| 299 300**Example** 301 302 ```ts 303 import distributedMissionManager from '@ohos.distributedMissionManager' 304 import { BusinessError } from '@ohos.base'; 305 try { 306 distributedMissionManager.stopSyncRemoteMissions( 307 { 308 deviceId: "" 309 }, 310 (error: BusinessError) => { 311 if (error.code != 0) { 312 console.error('stopSyncRemoteMissions failed, cause: ' + JSON.stringify(error)) 313 } 314 console.info('stopSyncRemoteMissions finished')} 315 ) 316 } catch (error) { 317 console.error('stopSyncRemoteMissions failed, cause: ' + JSON.stringify(error)) 318 } 319 ``` 320 321## distributedMissionManager.stopSyncRemoteMissions 322 323stopSyncRemoteMissions(parameter: MissionDeviceInfo): Promise<void> 324 325Stops synchronizing the remote mission list. This API uses a promise to return the result. 326 327**Required permissions**: ohos.permission.MANAGE_MISSIONS 328 329**System capability**: SystemCapability.Ability.AbilityRuntime.Mission 330 331**Parameters** 332 333| Name | Type | Mandatory | Description | 334| --------- | --------------------------------------- | ---- | ----- | 335| parameter | [MissionDeviceInfo](#missiondeviceinfo) | Yes | Parameters required for synchronization.| 336 337**Return value** 338 339| Type | Description | 340| ------------------- | ---------------- | 341| Promise<void> | Promise that returns no value.| 342 343**Example** 344 345 ```ts 346 import distributedMissionManager from '@ohos.distributedMissionManager' 347 import { BusinessError } from '@ohos.base'; 348 try { 349 distributedMissionManager.stopSyncRemoteMissions( 350 { 351 deviceId: "" 352 }).then((data: void) => { 353 console.info('stopSyncRemoteMissions finished successfully'); 354 }).catch((error: BusinessError) => { 355 console.error('stopSyncRemoteMissions failed, cause: ' + JSON.stringify(error)); 356 }) 357 } catch (error) { 358 console.error('stopSyncRemoteMissions failed, cause: ' + JSON.stringify(error)) 359 } 360 ``` 361 362## distributedMissionManager.continueMission 363 364continueMission(parameter: ContinueDeviceInfo, options: ContinueCallback, callback: AsyncCallback<void>): void; 365 366Continues a mission on a remote device, with the mission ID specified. This API uses an asynchronous callback to return the result. 367 368**Required permissions**: ohos.permission.MANAGE_MISSIONS and ohos.permission.DISTRIBUTED_DATASYNC 369 370**System capability**: SystemCapability.Ability.AbilityRuntime.Mission 371 372**Parameters** 373 374| Name | Type | Mandatory | Description | 375| --------- | --------------------------------------- | ---- | ----- | 376| parameter | [ContinueDeviceInfo](js-apis-inner-application-continueDeviceInfo.md) | Yes | Parameters required for mission continuation.| 377| options | [ContinueCallback](js-apis-inner-application-continueCallback.md) | Yes | Callback invoked when the mission continuation is complete.| 378| callback | AsyncCallback<void> | Yes | Callback used to return the result. If the mission is continued, **err** is **undefined**. Otherwise, **err** is an error object.| 379 380**Error codes** 381 382For details about the error codes, see [Distributed Scheduler Error Codes](../errorcodes/errorcode-DistributedSchedule.md). 383 384| ID| Error Message| 385| ------- | -------------------------------------------- | 386| 16300501 | The system ability work abnormally. | 387| 16300502 | Failed to get the missionInfo of the specified missionId. | 388| 16300503 | The application is not installed on the remote end and installation-free is not supported. | 389| 16300504 | The application is not installed on the remote end but installation-free is supported, try again with freeInstall flag. | 390| 16300505 | The operation device must be the device where the application to be continued is located or the target device to be continued. | 391| 16300506 | The local continuation task is already in progress. | 392 393**Example** 394 395 ```ts 396 import distributedMissionManager from '@ohos.distributedMissionManager' 397 import { BusinessError } from '@ohos.base'; 398 function onContinueDone(resultCode: number): void { 399 console.log('onContinueDone resultCode: ' + JSON.stringify(resultCode)); 400 }; 401 try { 402 distributedMissionManager.continueMission( 403 { 404 srcDeviceId: "", 405 dstDeviceId: "", 406 missionId: 1, 407 wantParam: {"key": "value"} 408 }, 409 { onContinueDone: onContinueDone }, 410 (error: BusinessError) => { 411 if (error.code != 0) { 412 console.error('continueMission failed, cause: ' + JSON.stringify(error)) 413 } 414 console.info('continueMission finished') 415 }) 416 } catch (error) { 417 console.error('continueMission failed, cause: ' + JSON.stringify(error)) 418 } 419 ``` 420 421## distributedMissionManager.continueMission 422 423continueMission(parameter: ContinueDeviceInfo, options: ContinueCallback): Promise<void> 424 425Continues a mission on a remote device, with the mission ID specified. This API uses a promise to return the result. 426 427**Required permissions**: ohos.permission.MANAGE_MISSIONS and ohos.permission.DISTRIBUTED_DATASYNC 428 429**System capability**: SystemCapability.Ability.AbilityRuntime.Mission 430 431**Parameters** 432 433| Name | Type | Mandatory | Description | 434| --------- | --------------------------------------- | ---- | ----- | 435| parameter | [ContinueDeviceInfo](js-apis-inner-application-continueDeviceInfo.md) | Yes | Parameters required for mission continuation.| 436| options | [ContinueCallback](js-apis-inner-application-continueCallback.md) | Yes | Callback invoked when the mission continuation is complete.| 437 438**Return value** 439 440| Type | Description | 441| ------------------- | ---------------- | 442| Promise<void> |Promise that returns no value.| 443 444**Error codes** 445 446For details about the error codes, see [Distributed Scheduler Error Codes](../errorcodes/errorcode-DistributedSchedule.md). 447 448| ID| Error Message| 449| ------- | -------------------------------------------- | 450| 16300501 | The system ability work abnormally. | 451| 16300502 | Failed to get the missionInfo of the specified missionId. | 452| 16300503 | The application is not installed on the remote end and installation-free is not supported. | 453| 16300504 | The application is not installed on the remote end but installation-free is supported, try again with freeInstall flag. | 454| 16300505 | The operation device must be the device where the application to be continued is located or the target device to be continued. | 455| 16300506 | The local continuation task is already in progress. | 456 457**Example** 458 459 ```ts 460 import distributedMissionManager from '@ohos.distributedMissionManager' 461 import { BusinessError } from '@ohos.base'; 462 function onContinueDone(resultCode: number): void { 463 console.log('onContinueDone resultCode: ' + JSON.stringify(resultCode)); 464 }; 465 try { 466 distributedMissionManager.continueMission( 467 { 468 srcDeviceId: "", 469 dstDeviceId: "", 470 missionId: 1, 471 wantParam: {"key": "value"} 472 }, 473 { onContinueDone: onContinueDone }).then(() => { 474 console.info('continueMission finished successfully'); 475 }).catch((error: BusinessError) => { 476 console.error('continueMission failed, cause: ' + JSON.stringify(error)); 477 }) 478 } catch (error) { 479 console.error('continueMission failed, cause: ' + JSON.stringify(error)) 480 } 481 ``` 482 483## distributedMissionManager.continueMission<sup>10+</sup> 484 485continueMission(parameter: ContinueMissionInfo, callback: AsyncCallback<void>): void; 486 487Continues a mission on a remote device, with the bundle name specified. This API uses an asynchronous callback to return the result. 488 489**Required permissions**: ohos.permission.MANAGE_MISSIONS and ohos.permission.DISTRIBUTED_DATASYNC 490 491**System capability**: SystemCapability.Ability.AbilityRuntime.Mission 492 493**Parameters** 494 495| Name | Type | Mandatory | Description | 496| --------- | --------------------------------------- | ---- | ----- | 497| parameter | [ContinueMissionInfo](./js-apis-inner-application-continueMissionInfo.md) | Yes | Parameters required for mission continuation.| 498| callback | AsyncCallback<void> | Yes | Callback used to return the result. If the mission is continued, **err** is **undefined**. Otherwise, **err** is an error object.| 499 500**Error codes** 501 502For details about the error codes, see [Distributed Scheduler Error Codes](../errorcodes/errorcode-DistributedSchedule.md). 503 504| ID| Error Message| 505| ------- | -------------------------------------------- | 506| 16300501 | The system ability work abnormally. | 507| 16300503 | The application is not installed on the remote end and installation-free is not supported. | 508| 16300504 | The application is not installed on the remote end but installation-free is supported, try again with freeInstall flag. | 509| 16300505 | The operation device must be the device where the application to be continued is located or the target device to be continued. | 510| 16300506 | The local continuation task is already in progress. | 511| 16300507 | Failed to get the missionInfo of the specified bundle name. | 512 513**Example** 514 515 ```ts 516 import distributedMissionManager from '@ohos.distributedMissionManager' 517 import { BusinessError } from '@ohos.base'; 518 try { 519 distributedMissionManager.continueMission( 520 { 521 srcDeviceId: "", 522 dstDeviceId: "", 523 bundleName: "ohos.test.continueapp", 524 wantParam: {"key": "value"} 525 }, 526 (error: BusinessError) => { 527 if (error.code != 0) { 528 console.error('continueMission failed, cause: ' + JSON.stringify(error)) 529 } 530 console.info('continueMission finished') 531 }) 532 } catch (error) { 533 console.error('continueMission failed, cause: ' + JSON.stringify(error)) 534 } 535 ``` 536 537## distributedMissionManager.continueMission<sup>10+</sup> 538 539continueMission(parameter: ContinueMissionInfo): Promise<void> 540 541Continues a mission on a remote device, with the bundle name specified. This API uses a promise to return the result. 542 543**Required permissions**: ohos.permission.MANAGE_MISSIONS and ohos.permission.DISTRIBUTED_DATASYNC 544 545**System capability**: SystemCapability.Ability.AbilityRuntime.Mission 546 547**Parameters** 548 549| Name | Type | Mandatory | Description | 550| --------- | --------------------------------------- | ---- | ----- | 551| parameter | [ContinueMissionInfo](./js-apis-inner-application-continueMissionInfo.md) | Yes | Parameters required for mission continuation.| 552 553**Return value** 554 555| Type | Description | 556| ------------------- | ---------------- | 557| Promise<void> | Promise that returns no value.| 558 559**Error codes** 560 561For details about the error codes, see [Distributed Scheduler Error Codes](../errorcodes/errorcode-DistributedSchedule.md). 562 563| ID| Error Message| 564| ------- | -------------------------------------------- | 565| 16300501 | The system ability work abnormally. | 566| 16300503 | The application is not installed on the remote end and installation-free is not supported. | 567| 16300504 | The application is not installed on the remote end but installation-free is supported, try again with freeInstall flag. | 568| 16300505 | The operation device must be the device where the application to be continued is located or the target device to be continued. | 569| 16300506 | The local continuation task is already in progress. | 570| 16300507 | Failed to get the missionInfo of the specified bundle name. | 571 572**Example** 573 574 ```ts 575 import distributedMissionManager from '@ohos.distributedMissionManager' 576 import { BusinessError } from '@ohos.base'; 577 try { 578 distributedMissionManager.continueMission( 579 { 580 srcDeviceId: "", 581 dstDeviceId: "", 582 bundleName: "ohos.test.continueapp", 583 wantParam: {"key": "value"} 584 } 585 ).then(() => { 586 console.info('continueMission finished successfully'); 587 }).catch((error: BusinessError) => { 588 console.error('continueMission failed, cause: ' + JSON.stringify(error)); 589 }) 590 } catch (error) { 591 console.error('continueMission failed, cause: ' + JSON.stringify(error)) 592 } 593 ``` 594 595## distributedMissionManager.on('continueStateChange')<sup>10+</sup> 596 597on(type: 'continueStateChange', callback: Callback<{ state: ContinueState, info: ContinuableInfo }>): void 598 599Subscribes to continuation state change events of the current mission. 600 601**Required permissions**: ohos.permission.MANAGE_MISSIONS 602 603**System capability**: SystemCapability.Ability.AbilityRuntime.Mission 604 605**Parameters** 606 607| Name | Type | Mandatory | Description | 608| --------- | ---------------------------------------- | ---- | -------- | 609| type | string | Yes | Event type. The value **'continueStateChange'** indicates the continuation state change event of the current mission. | 610| callback | Callback<{ state: [ContinueState](#continuestate10), info: [ContinuableInfo](./js-apis-inner-application-continuableInfo.md) }> | Yes | Callback used to return the continuation state and information of the current mission. | 611 612**Example** 613 614```js 615 import distributedMissionManager from '@ohos.distributedMissionManager' 616 try { 617 distributedMissionManager.on('continueStateChange', (data) => { 618 console.info("continueStateChange on:" + JSON.stringify(data)); 619 }); 620 } catch (error) { 621 console.error("continueStateChange err: " + JSON.stringify(error)); 622 } 623 ``` 624 625## distributedMissionManager.off('continueStateChange')<sup>10+</sup> 626 627off(type: 'continueStateChange', callback?: Callback<{ state: ContinueState, info: ContinuableInfo }>): void 628 629Unsubscribes from continuation state change events of the current mission. 630 631**Required permissions**: ohos.permission.MANAGE_MISSIONS 632 633**System capability**: SystemCapability.Ability.AbilityRuntime.Mission 634 635**Parameters** 636 637| Name | Type | Mandatory | Description | 638| --------- | ---------------------------------------- | ---- | -------- | 639| type | string | Yes | Event type. The value **'continueStateChange'** indicates the continuation state change event of the current mission. | 640| callback | Callback<{ state: [ContinueState](#continuestate10), info: [ContinuableInfo](./js-apis-inner-application-continuableInfo.md) }> | No | Callback used to return the continuation state and information of the current mission.<br>If the callback is unspecified, all subscriptions to the specified event are canceled. | 641 642**Example** 643 644```js 645 import distributedMissionManager from '@ohos.distributedMissionManager' 646 try { 647 distributedMissionManager.off('continueStateChange', (data) => { 648 console.info("continueStateChange off:" + JSON.stringify(data)); 649 }); 650 } catch (err) { 651 console.error("continueStateChange err: " + JSON.stringify(error)); 652 } 653 ``` 654 655## MissionCallback 656 657Defines the callbacks that can be registered as a mission status listener. 658 659**Required permissions**: ohos.permission.MANAGE_MISSIONS 660 661**System capability**: SystemCapability.Ability.AbilityRuntime.Mission 662 663| Name | Type | Readable | Writable | Description | 664| --------------------- | -------- | ---- | ---- | ------------------ | 665| notifyMissionsChanged | function | Yes | No | Callback used to notify the mission change event and return the device ID. | 666| notifySnapshot | function | Yes | No | Callback used to notify the snapshot change event and return the device ID and mission ID.| 667| notifyNetDisconnect | function | Yes | No | Callback used to notify the disconnection event and return the device ID and network status.| 668 669## MissionParameter 670 671Defines the parameters required for mission synchronization. 672 673**Required permissions**: ohos.permission.MANAGE_MISSIONS 674 675**System capability**: SystemCapability.Ability.AbilityRuntime.Mission 676 677| Name | Type | Readable | Writable | Description | 678| ----------- | ------- | ---- | ---- | ----------- | 679| deviceId | string | Yes | Yes | Device ID. | 680| fixConflict | boolean | Yes | Yes | Whether a version conflict occurs.| 681| tag | number | Yes | Yes | Tag of the mission. | 682 683## MissionDeviceInfo 684 685Defines the parameters required for registering a listener. 686 687**Required permissions**: ohos.permission.MANAGE_MISSIONS 688 689**System capability**: SystemCapability.Ability.AbilityRuntime.Mission 690 691| Name | Type | Readable | Writable | Description | 692| -------- | ------ | ---- | ---- | ------- | 693| deviceId | string | Yes | Yes | Device ID.| 694 695## ContinueState<sup>10+</sup> 696 697Enumerates the mission continuation states. 698 699**System capability**: SystemCapability.Ability.AbilityRuntime.Mission 700 701| Name | Value | Description | 702| ------------- | --------- | ------------------------------------------------------------ | 703| ACTIVE | 0 | Continuation is activated for the current mission. | 704| INACTIVE | 1 | Continuation is not activated for the current mission. | 705