1# @ohos.app.ability.wantAgent (WantAgent) 2 3The **app.ability.WantAgent** module provides APIs for creating and comparing **WantAgent** objects, and obtaining the user ID, Want, and bundle name of a **WantAgent** object. You are advised to use this module, since it will replace the [@ohos.wantAgent](js-apis-wantAgent.md) module in the near future. 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## Modules to Import 10 11```ts 12import WantAgent from '@ohos.app.ability.wantAgent'; 13``` 14 15## WantAgent.getWantAgent 16 17getWantAgent(info: WantAgentInfo, callback: AsyncCallback\<WantAgent\>): void 18 19Obtains a **WantAgent** object. This API uses an asynchronous callback to return the result. If the creation fails, a null **WantAgent** object is returned. 20 21**System capability**: SystemCapability.Ability.AbilityRuntime.Core 22 23**Parameters** 24 25| Name | Type | Mandatory| Description | 26| -------- | -------------------------- | ---- | ----------------------- | 27| info | [WantAgentInfo](js-apis-inner-wantAgent-wantAgentInfo.md) | Yes | Information about the **WantAgent** object to obtain. | 28| callback | AsyncCallback\<WantAgent\> | Yes | Callback used to return the **WantAgent** object.| 29 30**Error codes** 31 32| ID | Error Message | 33|-----------|--------------------| 34| 16000007 | Service busy, there are concurrent tasks, waiting for retry.| 35| 16000151 | Invalid wantagent object.| 36 37For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). 38 39**Example** 40 41```ts 42import WantAgent, { WantAgent as _WantAgent} from '@ohos.app.ability.wantAgent'; 43import Want from '@ohos.app.ability.Want'; 44import { BusinessError } from '@ohos.base'; 45 46// WantAgent object 47let wantAgent: _WantAgent; 48// WantAgentInfo object 49let wantAgentInfo: WantAgent.WantAgentInfo = { 50 wants: [ 51 { 52 deviceId: 'deviceId', 53 bundleName: 'com.example.myapplication', 54 abilityName: 'EntryAbility', 55 action: 'action1', 56 entities: ['entity1'], 57 type: 'MIMETYPE', 58 uri: 'key={true,true,false}', 59 parameters: 60 { 61 mykey0: 2222, 62 mykey1: [1, 2, 3], 63 mykey2: '[1, 2, 3]', 64 mykey3: 'ssssssssssssssssssssssssss', 65 mykey4: [false, true, false], 66 mykey5: ['qqqqq', 'wwwwww', 'aaaaaaaaaaaaaaaaa'], 67 mykey6: true, 68 } 69 } as Want 70 ], 71 operationType: WantAgent.OperationType.START_ABILITIES, 72 requestCode: 0, 73 wantAgentFlags:[WantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] 74}; 75 76// getWantAgent callback 77function getWantAgentCallback(err: BusinessError, data: _WantAgent) { 78 if (err) { 79 console.error(`getWantAgent failed, code: ${JSON.stringify(err.code)}, message: ${JSON.stringify(err.message)}`); 80 } else { 81 wantAgent = data; 82 } 83} 84try { 85 WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); 86} catch(err) { 87 console.error(`getWantAgent failed, error: ${JSON.stringify(err)}`); 88} 89``` 90 91 92 93## WantAgent.getWantAgent 94 95getWantAgent(info: WantAgentInfo): Promise\<WantAgent\> 96 97Obtains a **WantAgent** object. This API uses a promise to return the result. If the creation fails, a null **WantAgent** object is returned. 98 99**System capability**: SystemCapability.Ability.AbilityRuntime.Core 100 101**Parameters** 102 103| Name| Type | Mandatory| Description | 104| ---- | ------------- | ---- | ------------- | 105| info | [WantAgentInfo](js-apis-inner-wantAgent-wantAgentInfo.md) | Yes | Information about the **WantAgent** object to obtain.| 106 107**Return value** 108 109| Type | Description | 110| ----------------------------------------------------------- | ------------------------------------------------------------ | 111| Promise\<WantAgent\> | Promise used to return the **WantAgent** object.| 112 113**Error codes** 114 115| ID | Error Message | 116|-----------|--------------------| 117| 16000007 | Service busy, there are concurrent tasks, waiting for retry.| 118| 16000151 | Invalid wantagent object.| 119 120For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). 121 122**Example** 123 124```ts 125import WantAgent, { WantAgent as _WantAgent} from '@ohos.app.ability.wantAgent'; 126import Want from '@ohos.app.ability.Want'; 127import { BusinessError } from '@ohos.base'; 128 129let wantAgent: _WantAgent; 130// WantAgentInfo object 131let wantAgentInfo: WantAgent.WantAgentInfo = { 132 wants: [ 133 { 134 deviceId: 'deviceId', 135 bundleName: 'com.example.myapplication', 136 abilityName: 'EntryAbility', 137 action: 'action1', 138 entities: ['entity1'], 139 type: 'MIMETYPE', 140 uri: 'key={true,true,false}', 141 parameters: 142 { 143 mykey0: 2222, 144 mykey1: [1, 2, 3], 145 mykey2: '[1, 2, 3]', 146 mykey3: 'ssssssssssssssssssssssssss', 147 mykey4: [false, true, false], 148 mykey5: ['qqqqq', 'wwwwww', 'aaaaaaaaaaaaaaaaa'], 149 mykey6: true, 150 } 151 } as Want 152 ], 153 operationType: WantAgent.OperationType.START_ABILITIES, 154 requestCode: 0, 155 wantAgentFlags:[WantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] 156}; 157 158try { 159 WantAgent.getWantAgent(wantAgentInfo).then((data) => { 160 wantAgent = data; 161 }).catch((err: BusinessError) => { 162 console.error(`getWantAgent failed, code: ${JSON.stringify(err.code)}, message: ${JSON.stringify(err.message)}`); 163 }); 164} catch (err) { 165 console.error(`getWantAgent failed! ${err.code} ${err.message}`); 166} 167``` 168 169 170 171## WantAgent.getBundleName 172 173getBundleName(agent: WantAgent, callback: AsyncCallback\<string\>): void 174 175Obtains the bundle name of a **WantAgent** object. This API uses an asynchronous callback to return the result. 176 177**System capability**: SystemCapability.Ability.AbilityRuntime.Core 178 179**Parameters** 180 181| Name | Type | Mandatory| Description | 182| -------- | ----------------------- | ---- | --------------------------------- | 183| agent | WantAgent | Yes | Target **WantAgent** object. | 184| callback | AsyncCallback\<string\> | Yes | Callback used to return the bundle name.| 185 186**Error codes** 187 188| ID | Error Message | 189|-----------|--------------------| 190| 16000007 | Service busy, there are concurrent tasks, waiting for retry.| 191| 16000151 | Invalid wantagent object.| 192 193For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). 194 195**Example** 196 197```ts 198import WantAgent, { WantAgent as _WantAgent} from '@ohos.app.ability.wantAgent'; 199import Want from '@ohos.app.ability.Want'; 200import { BusinessError } from '@ohos.base'; 201 202// WantAgent object 203let wantAgent: _WantAgent; 204// WantAgentInfo object 205let wantAgentInfo: WantAgent.WantAgentInfo = { 206 wants: [ 207 { 208 deviceId: 'deviceId', 209 bundleName: 'com.example.myapplication', 210 abilityName: 'EntryAbility', 211 action: 'action1', 212 entities: ['entity1'], 213 type: 'MIMETYPE', 214 uri: 'key={true,true,false}', 215 parameters: 216 { 217 mykey0: 2222, 218 mykey1: [1, 2, 3], 219 mykey2: '[1, 2, 3]', 220 mykey3: 'ssssssssssssssssssssssssss', 221 mykey4: [false, true, false], 222 mykey5: ['qqqqq', 'wwwwww', 'aaaaaaaaaaaaaaaaa'], 223 mykey6: true, 224 } 225 } as Want 226 ], 227 operationType: WantAgent.OperationType.START_ABILITIES, 228 requestCode: 0, 229 wantAgentFlags:[WantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] 230}; 231 232// getWantAgent callback 233function getWantAgentCallback(err: BusinessError, data: _WantAgent) { 234 if (err) { 235 console.error(`getWantAgent failed, code: ${JSON.stringify(err.code)}, message: ${JSON.stringify(err.message)}`); 236 } else { 237 wantAgent = data; 238 } 239 // getBundleName callback 240 let getBundleNameCallback = (err: BusinessError, data: string) => { 241 if(err) { 242 console.error(`getBundleName failed! ${err.code} ${err.message}`); 243 } else { 244 console.info(`getBundleName ok! ${JSON.stringify(data)}`); 245 } 246 } 247 try { 248 WantAgent.getBundleName(wantAgent, getBundleNameCallback); 249 } catch(err) { 250 console.error(`getBundleName failed! ${err.code} ${err.message}`); 251 } 252} 253try { 254 WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); 255} catch(err) { 256 console.error(`getWantAgent failed! ${err.code} ${err.message}`); 257} 258``` 259 260 261 262## WantAgent.getBundleName 263 264getBundleName(agent: WantAgent): Promise\<string\> 265 266Obtains the bundle name of a **WantAgent** object. This API uses a promise to return the result. 267 268**System capability**: SystemCapability.Ability.AbilityRuntime.Core 269 270**Parameters** 271 272| Name | Type | Mandatory| Description | 273| ----- | --------- | ---- | ------------- | 274| agent | WantAgent | Yes | Target **WantAgent** object.| 275 276**Return value** 277 278| Type | Description | 279| ----------------------------------------------------------- | ------------------------------------------------------------ | 280| Promise\<string\> | Promise used to return the bundle name.| 281 282**Error codes** 283 284| ID | Error Message | 285|-----------|--------------------| 286| 16000007 | Service busy, there are concurrent tasks, waiting for retry.| 287| 16000151 | Invalid wantagent object.| 288 289For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). 290 291**Example** 292 293```ts 294import WantAgent, { WantAgent as _WantAgent} from '@ohos.app.ability.wantAgent'; 295import Want from '@ohos.app.ability.Want'; 296import { BusinessError } from '@ohos.base'; 297 298 // WantAgent object 299let wantAgent: _WantAgent; 300// WantAgentInfo object 301let wantAgentInfo: WantAgent.WantAgentInfo = { 302 wants: [ 303 { 304 deviceId: 'deviceId', 305 bundleName: 'com.example.myapplication', 306 abilityName: 'EntryAbility', 307 action: 'action1', 308 entities: ['entity1'], 309 type: 'MIMETYPE', 310 uri: 'key={true,true,false}', 311 parameters: 312 { 313 mykey0: 2222, 314 mykey1: [1, 2, 3], 315 mykey2: '[1, 2, 3]', 316 mykey3: 'ssssssssssssssssssssssssss', 317 mykey4: [false, true, false], 318 mykey5: ['qqqqq', 'wwwwww', 'aaaaaaaaaaaaaaaaa'], 319 mykey6: true, 320 } 321 } as Want 322 ], 323 operationType: WantAgent.OperationType.START_ABILITIES, 324 requestCode: 0, 325 wantAgentFlags:[WantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] 326}; 327 328// getWantAgent callback 329function getWantAgentCallback(err: BusinessError, data: _WantAgent) { 330 if (err) { 331 console.error(`getWantAgent failed, code: ${JSON.stringify(err.code)}, message: ${JSON.stringify(err.message)}`); 332 } else { 333 wantAgent = data; 334 } 335 try { 336 WantAgent.getBundleName(wantAgent).then((data)=>{ 337 console.info(`getBundleName ok! ${JSON.stringify(data)}`); 338 }).catch((err: BusinessError)=>{ 339 console.error(`getBundleName failed! ${err.code} ${err.message}`); 340 }); 341 } catch(err){ 342 console.error(`getBundleName failed! ${err.code} ${err.message}`); 343 } 344} 345try { 346 WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); 347} catch(err) { 348 console.error(`getWantAgent failed! ${err.code} ${err.message}`); 349} 350``` 351 352 353 354## WantAgent.getUid 355 356getUid(agent: WantAgent, callback: AsyncCallback\<number\>): void 357 358Obtains the user ID of a **WantAgent** object. This API uses an asynchronous callback to return the result. 359 360**System capability**: SystemCapability.Ability.AbilityRuntime.Core 361 362**Parameters** 363 364| Name | Type | Mandatory| Description | 365| -------- | ----------------------- | ---- | ----------------------------------- | 366| agent | WantAgent | Yes | Target **WantAgent** object. | 367| callback | AsyncCallback\<number\> | Yes | Callback used to return the user ID.| 368 369**Error codes** 370 371| ID | Error Message | 372|-----------|--------------------| 373| 16000007 | Service busy, there are concurrent tasks, waiting for retry.| 374| 16000151 | Invalid wantagent object.| 375 376For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). 377 378**Example** 379 380```ts 381import WantAgent, { WantAgent as _WantAgent} from '@ohos.app.ability.wantAgent'; 382import Want from '@ohos.app.ability.Want'; 383import { BusinessError } from '@ohos.base'; 384 385// WantAgent object 386let wantAgent: _WantAgent; 387// WantAgentInfo object 388let wantAgentInfo: WantAgent.WantAgentInfo = { 389 wants: [ 390 { 391 deviceId: 'deviceId', 392 bundleName: 'com.example.myapplication', 393 abilityName: 'EntryAbility', 394 action: 'action1', 395 entities: ['entity1'], 396 type: 'MIMETYPE', 397 uri: 'key={true,true,false}', 398 parameters: 399 { 400 mykey0: 2222, 401 mykey1: [1, 2, 3], 402 mykey2: '[1, 2, 3]', 403 mykey3: 'ssssssssssssssssssssssssss', 404 mykey4: [false, true, false], 405 mykey5: ['qqqqq', 'wwwwww', 'aaaaaaaaaaaaaaaaa'], 406 mykey6: true, 407 } 408 } as Want 409 ], 410 operationType: WantAgent.OperationType.START_ABILITIES, 411 requestCode: 0, 412 wantAgentFlags:[WantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] 413}; 414 415// getWantAgent callback 416function getWantAgentCallback(err: BusinessError, data: _WantAgent) { 417 if (err) { 418 console.info(`getWantAgent failed, code: ${JSON.stringify(err.code)}, message: ${JSON.stringify(err.message)}`); 419 } else { 420 wantAgent = data; 421 } 422 // getUid callback 423 let getUidCallback = (err: BusinessError, data: number) => { 424 if(err) { 425 console.error(`getUid failed! ${err.code} ${err.message}`); 426 } else { 427 console.info(`getUid ok! ${JSON.stringify(data)}`); 428 } 429 } 430 try { 431 WantAgent.getUid(wantAgent, getUidCallback); 432 } catch(err) { 433 console.error(`getUid failed! ${err.code} ${err.message}`); 434 } 435} 436try { 437 WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); 438} catch(err) { 439 console.error(`getWantAgent failed! ${err.code} ${err.message}`); 440} 441``` 442 443 444 445## WantAgent.getUid 446 447getUid(agent: WantAgent): Promise\<number\> 448 449Obtains the user ID of a **WantAgent** object. This API uses a promise to return the result. 450 451**System capability**: SystemCapability.Ability.AbilityRuntime.Core 452 453**Parameters** 454 455| Name | Type | Mandatory| Description | 456| ----- | --------- | ---- | ------------- | 457| agent | WantAgent | Yes | Target **WantAgent** object.| 458 459**Return value** 460 461| Type | Description | 462| ----------------------------------------------------------- | ------------------------------------------------------------ | 463| Promise\<number\> | Promise used to return the user ID.| 464 465**Error codes** 466 467| ID | Error Message | 468|-----------|--------------------| 469| 16000007 | Service busy, there are concurrent tasks, waiting for retry.| 470| 16000151 | Invalid wantagent object.| 471 472For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). 473 474**Example** 475 476```ts 477import WantAgent, { WantAgent as _WantAgent} from '@ohos.app.ability.wantAgent'; 478import Want from '@ohos.app.ability.Want'; 479import { BusinessError } from '@ohos.base'; 480 481// WantAgent object 482let wantAgent: _WantAgent; 483// WantAgentInfo object 484let wantAgentInfo: WantAgent.WantAgentInfo = { 485 wants: [ 486 { 487 deviceId: 'deviceId', 488 bundleName: 'com.example.myapplication', 489 abilityName: 'EntryAbility', 490 action: 'action1', 491 entities: ['entity1'], 492 type: 'MIMETYPE', 493 uri: 'key={true,true,false}', 494 parameters: 495 { 496 mykey0: 2222, 497 mykey1: [1, 2, 3], 498 mykey2: '[1, 2, 3]', 499 mykey3: 'ssssssssssssssssssssssssss', 500 mykey4: [false, true, false], 501 mykey5: ['qqqqq', 'wwwwww', 'aaaaaaaaaaaaaaaaa'], 502 mykey6: true, 503 } 504 } as Want 505 ], 506 operationType: WantAgent.OperationType.START_ABILITIES, 507 requestCode: 0, 508 wantAgentFlags:[WantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] 509}; 510 511// getWantAgent callback 512function getWantAgentCallback(err: BusinessError, data: _WantAgent) { 513 if (err) { 514 console.info(`getWantAgent failed, code: ${JSON.stringify(err.code)}, message: ${JSON.stringify(err.message)}`); 515 } else { 516 wantAgent = data; 517 } 518 try { 519 WantAgent.getUid(wantAgent).then((data)=>{ 520 console.info(`getUid ok! ${JSON.stringify(data)}`); 521 }).catch((err: BusinessError)=>{ 522 console.error(`getUid failed! ${err.code} ${err.message}`); 523 }); 524 } catch(err){ 525 console.error(`getUid failed! ${err.code} ${err.message}`); 526 } 527} 528try { 529 WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); 530} catch(err) { 531 console.error(`getWantAgent failed! ${err.code} ${err.message}`); 532} 533``` 534 535 536## WantAgent.getWant 537 538getWant(agent: WantAgent, callback: AsyncCallback\<Want\>): void 539 540Obtains the Want in a **WantAgent** object. This API uses an asynchronous callback to return the result. 541 542**System capability**: SystemCapability.Ability.AbilityRuntime.Core 543 544**System API**: This is a system API and cannot be called by third-party applications. 545 546**Parameters** 547 548| Name | Type | Mandatory| Description | 549| -------- | --------------------- | ---- | ------------------------------- | 550| agent | WantAgent | Yes | Target **WantAgent** object. | 551| callback | AsyncCallback\<[Want](js-apis-app-ability-want.md)\> | Yes | Callback used to return the Want.| 552 553**Error codes** 554 555| ID | Error Message | 556|-----------|--------------------| 557| 16000007 | Service busy, there are concurrent tasks, waiting for retry.| 558| 16000015 | Service timeout.| 559| 16000151 | Invalid wantagent object.| 560 561For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). 562 563**Example** 564 565```ts 566import WantAgent, { WantAgent as _WantAgent} from '@ohos.app.ability.wantAgent'; 567import Want from '@ohos.app.ability.Want'; 568import { BusinessError } from '@ohos.base'; 569 570// WantAgent object 571let wantAgent: _WantAgent; 572// WantAgentInfo object 573let wantAgentInfo: WantAgent.WantAgentInfo = { 574 wants: [ 575 { 576 deviceId: 'deviceId', 577 bundleName: 'com.example.myapplication', 578 abilityName: 'EntryAbility', 579 action: 'action1', 580 entities: ['entity1'], 581 type: 'MIMETYPE', 582 uri: 'key={true,true,false}', 583 parameters: 584 { 585 mykey0: 2222, 586 mykey1: [1, 2, 3], 587 mykey2: '[1, 2, 3]', 588 mykey3: 'ssssssssssssssssssssssssss', 589 mykey4: [false, true, false], 590 mykey5: ['qqqqq', 'wwwwww', 'aaaaaaaaaaaaaaaaa'], 591 mykey6: true, 592 } 593 } as Want 594 ], 595 operationType: WantAgent.OperationType.START_ABILITIES, 596 requestCode: 0, 597 wantAgentFlags:[WantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] 598}; 599 600// getWantAgent callback 601function getWantAgentCallback(err: BusinessError, data: _WantAgent) { 602 if (err) { 603 console.info(`getWantAgent failed, code: ${JSON.stringify(err.code)}, message: ${JSON.stringify(err.message)}`); 604 } else { 605 wantAgent = data; 606 } 607 // getWant callback 608 let getWantCallback = (err: BusinessError, data: Want) => { 609 if(err) { 610 console.error(`getWant failed! ${err.code} ${err.message}`); 611 } else { 612 console.info(`getWant ok! ${JSON.stringify(data)}`); 613 } 614 } 615 try { 616 WantAgent.getWant(wantAgent, getWantCallback); 617 } catch(err) { 618 console.error(`getWant failed! ${err.code} ${err.message}`); 619 } 620} 621try { 622 WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); 623} catch(err) { 624 console.error(`getWantAgent failed! ${err.code} ${err.message}`); 625} 626``` 627 628 629 630## WantAgent.getWant 631 632getWant(agent: WantAgent): Promise\<Want\> 633 634Obtains the Want in a **WantAgent** object. This API uses a promise to return the result. 635 636**System capability**: SystemCapability.Ability.AbilityRuntime.Core 637 638**System API**: This is a system API and cannot be called by third-party applications. 639 640**Parameters** 641 642| Name | Type | Mandatory| Description | 643| ----- | --------- | ---- | ------------- | 644| agent | WantAgent | Yes | Target **WantAgent** object.| 645 646**Return value** 647 648| Type | Description | 649| ----------------------------------------------------------- | ------------------------------------------------------------ | 650| Promise\<[Want](js-apis-app-ability-want.md)\> | Promise used to return the Want.| 651 652**Error codes** 653 654| ID | Error Message | 655|-----------|--------------------| 656| 16000007 | Service busy, there are concurrent tasks, waiting for retry.| 657| 16000015 | Service timeout.| 658| 16000151 | Invalid wantagent object.| 659 660For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). 661 662**Example** 663 664```ts 665import WantAgent, { WantAgent as _WantAgent} from '@ohos.app.ability.wantAgent'; 666import Want from '@ohos.app.ability.Want'; 667import { BusinessError } from '@ohos.base'; 668 669// WantAgent object 670let wantAgent: _WantAgent; 671// WantAgentInfo object 672let wantAgentInfo: WantAgent.WantAgentInfo = { 673 wants: [ 674 { 675 deviceId: 'deviceId', 676 bundleName: 'com.example.myapplication', 677 abilityName: 'EntryAbility', 678 action: 'action1', 679 entities: ['entity1'], 680 type: 'MIMETYPE', 681 uri: 'key={true,true,false}', 682 parameters: 683 { 684 mykey0: 2222, 685 mykey1: [1, 2, 3], 686 mykey2: '[1, 2, 3]', 687 mykey3: 'ssssssssssssssssssssssssss', 688 mykey4: [false, true, false], 689 mykey5: ['qqqqq', 'wwwwww', 'aaaaaaaaaaaaaaaaa'], 690 mykey6: true, 691 } 692 } as Want 693 ], 694 operationType: WantAgent.OperationType.START_ABILITIES, 695 requestCode: 0, 696 wantAgentFlags:[WantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] 697}; 698 699// getWantAgent callback 700function getWantAgentCallback(err: BusinessError, data: _WantAgent) { 701 if (err) { 702 console.info(`getWantAgent failed, code: ${JSON.stringify(err.code)}, message: ${JSON.stringify(err.message)}`); 703 } else { 704 wantAgent = data; 705 } 706 try { 707 WantAgent.getUid(wantAgent).then((data)=>{ 708 console.info(`getUid ok! ${JSON.stringify(data)}`); 709 }).catch((err: BusinessError)=>{ 710 console.error(`getUid failed! ${err.code} ${err.message}`); 711 }); 712 } catch(err){ 713 console.error(`getUid failed! ${err.code} ${err.message}`); 714 } 715} 716try { 717 WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); 718} catch(err) { 719 console.error(`getWantAgent failed! ${err.code} ${err.message}}`); 720} 721``` 722 723 724 725## WantAgent.cancel 726 727cancel(agent: WantAgent, callback: AsyncCallback\<void\>): void 728 729Cancels a **WantAgent** object. This API uses an asynchronous callback to return the result. 730 731**System capability**: SystemCapability.Ability.AbilityRuntime.Core 732 733**Parameters** 734 735| Name | Type | Mandatory| Description | 736| -------- | --------------------- | ---- | --------------------------- | 737| agent | WantAgent | Yes | Target **WantAgent** object. | 738| callback | AsyncCallback\<void\> | Yes | Callback used to return the result.| 739 740**Error codes** 741 742| ID | Error Message | 743|-----------|--------------------| 744| 16000007 | Service busy, there are concurrent tasks, waiting for retry.| 745| 16000151 | Invalid wantagent object.| 746 747For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). 748 749**Example** 750 751```ts 752import WantAgent, { WantAgent as _WantAgent} from '@ohos.app.ability.wantAgent'; 753import Want from '@ohos.app.ability.Want'; 754import { BusinessError } from '@ohos.base'; 755 756// WantAgent object 757let wantAgent: _WantAgent; 758// WantAgentInfo object 759let wantAgentInfo: WantAgent.WantAgentInfo = { 760 wants: [ 761 { 762 deviceId: 'deviceId', 763 bundleName: 'com.example.myapplication', 764 abilityName: 'EntryAbility', 765 action: 'action1', 766 entities: ['entity1'], 767 type: 'MIMETYPE', 768 uri: 'key={true,true,false}', 769 parameters: 770 { 771 mykey0: 2222, 772 mykey1: [1, 2, 3], 773 mykey2: '[1, 2, 3]', 774 mykey3: 'ssssssssssssssssssssssssss', 775 mykey4: [false, true, false], 776 mykey5: ['qqqqq', 'wwwwww', 'aaaaaaaaaaaaaaaaa'], 777 mykey6: true, 778 } 779 } as Want 780 ], 781 operationType: WantAgent.OperationType.START_ABILITIES, 782 requestCode: 0, 783 wantAgentFlags:[WantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] 784}; 785 786// getWantAgent callback 787function getWantAgentCallback(err: BusinessError, data: _WantAgent) { 788 if (err) { 789 console.info(`getWantAgent failed, code: ${JSON.stringify(err.code)}, message: ${JSON.stringify(err.message)}`); 790 } else { 791 wantAgent = data; 792 } 793 // cancel callback 794 let cancelCallback = (err: BusinessError, data: void) => { 795 if(err) { 796 console.error(`cancel failed! ${err.code} ${err.message}`); 797 } else { 798 console.info(`cancel ok!`); 799 } 800 } 801 try { 802 WantAgent.cancel(wantAgent, cancelCallback); 803 } catch(err) { 804 console.error(`cancel failed! ${err.code} ${err.message}`); 805 } 806} 807try { 808 WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); 809} catch(err) { 810 console.error(`getWantAgent failed! ${err.code} ${err.message}`); 811} 812``` 813 814 815 816## WantAgent.cancel 817 818cancel(agent: WantAgent): Promise\<void\> 819 820Cancels a **WantAgent** object. This API uses a promise to return the result. 821 822**System capability**: SystemCapability.Ability.AbilityRuntime.Core 823 824**Parameters** 825 826| Name | Type | Mandatory| Description | 827| ----- | --------- | ---- | ------------- | 828| agent | WantAgent | Yes | Target **WantAgent** object.| 829 830**Return value** 831 832| Type | Description | 833| --------------- | ------------------------------- | 834| Promise\<void\> | Promise used to return the result.| 835 836**Error codes** 837 838| ID | Error Message | 839|-----------|--------------------| 840| 16000007 | Service busy, there are concurrent tasks, waiting for retry.| 841| 16000151 | Invalid wantagent object.| 842 843For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). 844 845**Example** 846 847```ts 848import WantAgent, { WantAgent as _WantAgent} from '@ohos.app.ability.wantAgent'; 849import Want from '@ohos.app.ability.Want'; 850import { BusinessError } from '@ohos.base'; 851 852// WantAgent object 853let wantAgent: _WantAgent; 854// WantAgentInfo object 855let wantAgentInfo: WantAgent.WantAgentInfo = { 856 wants: [ 857 { 858 deviceId: 'deviceId', 859 bundleName: 'com.example.myapplication', 860 abilityName: 'EntryAbility', 861 action: 'action1', 862 entities: ['entity1'], 863 type: 'MIMETYPE', 864 uri: 'key={true,true,false}', 865 parameters: 866 { 867 mykey0: 2222, 868 mykey1: [1, 2, 3], 869 mykey2: '[1, 2, 3]', 870 mykey3: 'ssssssssssssssssssssssssss', 871 mykey4: [false, true, false], 872 mykey5: ['qqqqq', 'wwwwww', 'aaaaaaaaaaaaaaaaa'], 873 mykey6: true, 874 } 875 } as Want 876 ], 877 operationType: WantAgent.OperationType.START_ABILITIES, 878 requestCode: 0, 879 wantAgentFlags:[WantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] 880}; 881 882// getWantAgent callback 883function getWantAgentCallback(err: BusinessError, data: _WantAgent) { 884 if (err) { 885 console.info(`getWantAgent failed, code: ${JSON.stringify(err.code)}, message: ${JSON.stringify(err.message)}`); 886 } else { 887 wantAgent = data; 888 } 889 try { 890 WantAgent.cancel(wantAgent).then((data)=>{ 891 console.info('cancel ok!'); 892 }).catch((err: BusinessError)=>{ 893 console.error(`cancel failed! ${err.code} ${err.message}`); 894 }); 895 } catch(err){ 896 console.error(`cancel failed! ${err.code} ${err.message}`); 897 } 898} 899try { 900 WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); 901} catch(err) { 902 console.error(`getWantAgent failed! ${err.code} ${err.message}`); 903} 904``` 905 906## WantAgent.trigger 907 908trigger(agent: WantAgent, triggerInfo: TriggerInfo, callback?: AsyncCallback\<CompleteData\>): void 909 910Triggers a **WantAgent** object. This API uses an asynchronous callback to return the result. 911 912**System capability**: SystemCapability.Ability.AbilityRuntime.Core 913 914**Parameters** 915 916| Name | Type | Mandatory| Description | 917| ----------- | ----------------------------- | ---- | ------------------------------- | 918| agent | WantAgent | Yes | Target **WantAgent** object. | 919| triggerInfo | [TriggerInfo](js-apis-inner-wantAgent-triggerInfo.md) | Yes | **TriggerInfo** object. | 920| callback | AsyncCallback\<[CompleteData](#completedata)\> | No | Callback used to return the result.| 921 922**Example** 923 924```ts 925import WantAgent, { WantAgent as _WantAgent} from '@ohos.app.ability.wantAgent'; 926import Want from '@ohos.app.ability.Want'; 927import { BusinessError } from '@ohos.base'; 928 929// WantAgent object 930let wantAgent: _WantAgent; 931// triggerInfo 932let triggerInfo: WantAgent.TriggerInfo = { 933 code: 0 // Custom result code. 934}; 935// WantAgentInfo object 936let wantAgentInfo: WantAgent.WantAgentInfo = { 937 wants: [ 938 { 939 deviceId: 'deviceId', 940 bundleName: 'com.example.myapplication', 941 abilityName: 'EntryAbility', 942 action: 'action1', 943 entities: ['entity1'], 944 type: 'MIMETYPE', 945 uri: 'key={true,true,false}', 946 parameters: 947 { 948 mykey0: 2222, 949 mykey1: [1, 2, 3], 950 mykey2: '[1, 2, 3]', 951 mykey3: 'ssssssssssssssssssssssssss', 952 mykey4: [false, true, false], 953 mykey5: ['qqqqq', 'wwwwww', 'aaaaaaaaaaaaaaaaa'], 954 mykey6: true, 955 } 956 } as Want 957 ], 958 operationType: WantAgent.OperationType.START_ABILITIES, 959 requestCode: 0, 960 wantAgentFlags:[WantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] 961}; 962 963// getWantAgent callback 964function getWantAgentCallback(err: BusinessError, data: _WantAgent) { 965 if (err) { 966 console.info(`getWantAgent failed, code: ${JSON.stringify(err.code)}, message: ${JSON.stringify(err.message)}`); 967 } else { 968 wantAgent = data; 969 } 970 // trigger callback 971 let triggerCallback = (err: BusinessError, data: WantAgent.CompleteData) => { 972 if(err) { 973 console.error(`getUid failed! ${err.code} ${err.message}`); 974 } else { 975 console.info(`getUid ok! ${JSON.stringify(data)}`); 976 } 977 } 978 try { 979 WantAgent.trigger(wantAgent, triggerInfo, triggerCallback); 980 } catch(err) { 981 console.error(`getUid failed! ${err.code} ${err.message}`); 982 } 983} 984try { 985 WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); 986} catch(err) { 987 console.error(`getWantAgent failed! ${err.code} ${err.message}`); 988} 989``` 990 991 992 993## WantAgent.equal 994 995equal(agent: WantAgent, otherAgent: WantAgent, callback: AsyncCallback\<boolean\>): void 996 997Checks whether two **WantAgent** objects are equal to determine whether the same operation is from the same application. This API uses an asynchronous callback to return the result. 998 999**System capability**: SystemCapability.Ability.AbilityRuntime.Core 1000 1001**Parameters** 1002 1003| Name | Type | Mandatory| Description | 1004| ---------- | ------------------------ | ---- | --------------------------------------- | 1005| agent | WantAgent | Yes | The first **WantAgent** object. | 1006| otherAgent | WantAgent | Yes | The second **WantAgent** object. | 1007| callback | AsyncCallback\<boolean\> | Yes | Callback used to return the result.| 1008 1009**Example** 1010 1011```ts 1012import WantAgent, { WantAgent as _WantAgent} from '@ohos.app.ability.wantAgent'; 1013import Want from '@ohos.app.ability.Want'; 1014import { BusinessError } from '@ohos.base'; 1015 1016// WantAgent object 1017let wantAgent1: _WantAgent; 1018let wantAgent2: _WantAgent; 1019// WantAgentInfo object 1020let wantAgentInfo: WantAgent.WantAgentInfo = { 1021 wants: [ 1022 { 1023 deviceId: 'deviceId', 1024 bundleName: 'com.example.myapplication', 1025 abilityName: 'EntryAbility', 1026 action: 'action1', 1027 entities: ['entity1'], 1028 type: 'MIMETYPE', 1029 uri: 'key={true,true,false}', 1030 parameters: 1031 { 1032 mykey0: 2222, 1033 mykey1: [1, 2, 3], 1034 mykey2: '[1, 2, 3]', 1035 mykey3: 'ssssssssssssssssssssssssss', 1036 mykey4: [false, true, false], 1037 mykey5: ['qqqqq', 'wwwwww', 'aaaaaaaaaaaaaaaaa'], 1038 mykey6: true, 1039 } 1040 } as Want 1041 ], 1042 operationType: WantAgent.OperationType.START_ABILITIES, 1043 requestCode: 0, 1044 wantAgentFlags:[WantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] 1045}; 1046 1047// getWantAgent callback 1048function getWantAgentCallback(err: BusinessError, data: _WantAgent) { 1049 if (err) { 1050 console.error(`getWantAgent failed, code: ${JSON.stringify(err.code)}, message: ${JSON.stringify(err.message)}`); 1051 } else { 1052 wantAgent1 = data; 1053 wantAgent2 = data; 1054 } 1055 // equal callback 1056 let equalCallback = (err: BusinessError, data: boolean) => { 1057 if(err) { 1058 console.error(`equal failed! ${err.code} ${err.message}`); 1059 } else { 1060 console.info(`equal ok! ${JSON.stringify(data)}`); 1061 } 1062 } 1063 try { 1064 WantAgent.equal(wantAgent1,wantAgent2,equalCallback); 1065 } catch(err) { 1066 console.error(`equal failed! ${err.code} ${err.message}`); 1067 } 1068} 1069try { 1070 WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); 1071} catch(err) { 1072 console.error(`getWantAgent failed! ${err.code} ${err.message}`); 1073} 1074``` 1075 1076 1077 1078## WantAgent.equal 1079 1080equal(agent: WantAgent, otherAgent: WantAgent): Promise\<boolean\> 1081 1082Checks whether two **WantAgent** objects are equal to determine whether the same operation is from the same application. This API uses a promise to return the result. 1083 1084**System capability**: SystemCapability.Ability.AbilityRuntime.Core 1085 1086**Parameters** 1087 1088| Name | Type | Mandatory| Description | 1089| ---------- | --------- | ---- | ------------- | 1090| agent | WantAgent | Yes | The first **WantAgent** object.| 1091| otherAgent | WantAgent | Yes | The second **WantAgent** object.| 1092 1093**Return value** 1094 1095| Type | Description | 1096| ----------------------------------------------------------- | ------------------------------------------------------------ | 1097| Promise\<boolean\> | Promise used to return the result.| 1098 1099**Example** 1100 1101```ts 1102import WantAgent, { WantAgent as _WantAgent} from '@ohos.app.ability.wantAgent'; 1103import Want from '@ohos.app.ability.Want'; 1104import { BusinessError } from '@ohos.base'; 1105 1106// WantAgent object 1107let wantAgent1: _WantAgent; 1108let wantAgent2: _WantAgent; 1109// WantAgentInfo object 1110let wantAgentInfo: WantAgent.WantAgentInfo = { 1111 wants: [ 1112 { 1113 deviceId: 'deviceId', 1114 bundleName: 'com.example.myapplication', 1115 abilityName: 'EntryAbility', 1116 action: 'action1', 1117 entities: ['entity1'], 1118 type: 'MIMETYPE', 1119 uri: 'key={true,true,false}', 1120 parameters: 1121 { 1122 mykey0: 2222, 1123 mykey1: [1, 2, 3], 1124 mykey2: '[1, 2, 3]', 1125 mykey3: 'ssssssssssssssssssssssssss', 1126 mykey4: [false, true, false], 1127 mykey5: ['qqqqq', 'wwwwww', 'aaaaaaaaaaaaaaaaa'], 1128 mykey6: true, 1129 } 1130 } as Want 1131 ], 1132 operationType: WantAgent.OperationType.START_ABILITIES, 1133 requestCode: 0, 1134 wantAgentFlags:[WantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] 1135}; 1136 1137// getWantAgent callback 1138function getWantAgentCallback(err: BusinessError, data: _WantAgent) { 1139 if (err) { 1140 console.error(`getWantAgent failed, code: ${JSON.stringify(err.code)}, message: ${JSON.stringify(err.message)}`); 1141 } else { 1142 wantAgent1 = data; 1143 wantAgent2 = data; 1144 } 1145 try { 1146 WantAgent.equal(wantAgent1,wantAgent2).then((data)=>{ 1147 console.info(`equal ok! ${JSON.stringify(data)}`); 1148 }).catch((err: BusinessError)=>{ 1149 console.error(`equal failed! ${err.code} ${err.message}`); 1150 }) 1151 } catch(err){ 1152 console.error(`equal failed! ${err.code} ${err.message}`); 1153 } 1154} 1155try { 1156 WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); 1157} catch(err) { 1158 console.error(`getWantAgent failed! ${err.code} ${err.message}`); 1159} 1160``` 1161 1162## WantAgent.getOperationType 1163 1164getOperationType(agent: WantAgent, callback: AsyncCallback\<number>): void; 1165 1166Obtains the operation type of a **WantAgent** object. This API uses an asynchronous callback to return the result. 1167 1168**System capability**: SystemCapability.Ability.AbilityRuntime.Core 1169 1170**Parameters** 1171 1172| Name | Type | Mandatory| Description | 1173| ---------- | ------------------------ | ---- | --------------------------------------- | 1174| agent | WantAgent | Yes | Target **WantAgent** object. | 1175| callback | AsyncCallback\<number> | Yes | Callback used to return the operation type.| 1176 1177**Error codes** 1178 1179| ID | Error Message | 1180|-----------|--------------------| 1181| 16000007 | Service busy, there are concurrent tasks, waiting for retry.| 1182| 16000015 | Service timeout.| 1183| 16000151 | Invalid wantagent object.| 1184 1185For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). 1186 1187**Example** 1188 1189```ts 1190import WantAgent, { WantAgent as _WantAgent} from '@ohos.app.ability.wantAgent'; 1191import Want from '@ohos.app.ability.Want'; 1192import { BusinessError } from '@ohos.base'; 1193 1194// WantAgent object 1195let wantAgent: _WantAgent; 1196// WantAgentInfo object 1197let wantAgentInfo: WantAgent.WantAgentInfo = { 1198 wants: [ 1199 { 1200 deviceId: 'deviceId', 1201 bundleName: 'com.example.myapplication', 1202 abilityName: 'EntryAbility', 1203 action: 'action1', 1204 entities: ['entity1'], 1205 type: 'MIMETYPE', 1206 uri: 'key={true,true,false}', 1207 parameters: 1208 { 1209 mykey0: 2222, 1210 mykey1: [1, 2, 3], 1211 mykey2: '[1, 2, 3]', 1212 mykey3: 'ssssssssssssssssssssssssss', 1213 mykey4: [false, true, false], 1214 mykey5: ['qqqqq', 'wwwwww', 'aaaaaaaaaaaaaaaaa'], 1215 mykey6: true, 1216 } 1217 } as Want 1218 ], 1219 operationType: WantAgent.OperationType.START_ABILITIES, 1220 requestCode: 0, 1221 wantAgentFlags:[WantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] 1222}; 1223 1224// getWantAgent callback 1225function getWantAgentCallback(err: BusinessError, data: _WantAgent) { 1226 if (err) { 1227 console.error(`getWantAgent failed, code: ${JSON.stringify(err.code)}, message: ${JSON.stringify(err.message)}`); 1228 } else { 1229 wantAgent = data; 1230 } 1231 // getOperationTypeCallback callback 1232 let getOperationTypeCallback = (err: BusinessError, data: number) => { 1233 if(err) { 1234 console.error(`getOperationType failed! ${err.code} ${err.message}`); 1235 } else { 1236 console.info(`getOperationType ok! ${JSON.stringify(data)}`); 1237 } 1238 } 1239 try { 1240 WantAgent.getOperationType(wantAgent, getOperationTypeCallback); 1241 } catch(err) { 1242 console.error(`getOperationTypeCallback failed! ${err.code} ${err.message}`); 1243 } 1244} 1245try { 1246 WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); 1247} catch(err) { 1248 console.error(`getWantAgent failed! ${err.code} ${err.message}`); 1249} 1250``` 1251 1252## WantAgent.getOperationType 1253 1254getOperationType(agent: WantAgent): Promise\<number>; 1255 1256Obtains the operation type of a **WantAgent** object. This API uses a promise to return the result. 1257 1258**System capability**: SystemCapability.Ability.AbilityRuntime.Core 1259 1260**Parameters** 1261 1262| Name | Type | Mandatory| Description | 1263| ---------- | --------- | ---- | ------------- | 1264| agent | WantAgent | Yes | Target **WantAgent** object.| 1265 1266**Return value** 1267 1268| Type | Description | 1269| ----------------------------------------------------------- | ------------------------------------------------------------ | 1270| Promise\<number> | Promise used to return the operation type.| 1271 1272**Error codes** 1273 1274| ID | Error Message | 1275|-----------|--------------------| 1276| 16000007 | Service busy, there are concurrent tasks, waiting for retry.| 1277| 16000015 | Service timeout.| 1278| 16000151 | Invalid wantagent object.| 1279 1280For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). 1281 1282**Example** 1283 1284```ts 1285import WantAgent, { WantAgent as _WantAgent} from '@ohos.app.ability.wantAgent'; 1286import Want from '@ohos.app.ability.Want'; 1287import { BusinessError } from '@ohos.base'; 1288 1289// WantAgent object 1290let wantAgent: _WantAgent; 1291// WantAgentInfo object 1292let wantAgentInfo: WantAgent.WantAgentInfo = { 1293 wants: [ 1294 { 1295 deviceId: 'deviceId', 1296 bundleName: 'com.example.myapplication', 1297 abilityName: 'EntryAbility', 1298 action: 'action1', 1299 entities: ['entity1'], 1300 type: 'MIMETYPE', 1301 uri: 'key={true,true,false}', 1302 parameters: 1303 { 1304 mykey0: 2222, 1305 mykey1: [1, 2, 3], 1306 mykey2: '[1, 2, 3]', 1307 mykey3: 'ssssssssssssssssssssssssss', 1308 mykey4: [false, true, false], 1309 mykey5: ['qqqqq', 'wwwwww', 'aaaaaaaaaaaaaaaaa'], 1310 mykey6: true, 1311 } 1312 } as Want 1313 ], 1314 operationType: WantAgent.OperationType.START_ABILITIES, 1315 requestCode: 0, 1316 wantAgentFlags:[WantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] 1317}; 1318 1319// getWantAgent callback 1320function getWantAgentCallback(err: BusinessError, data: _WantAgent) { 1321 if (err) { 1322 console.error(`getWantAgent failed, code: ${JSON.stringify(err.code)}, message: ${JSON.stringify(err.message)}`); 1323 } else { 1324 wantAgent = data; 1325 } 1326 try { 1327 WantAgent.getOperationType(wantAgent).then((data)=>{ 1328 console.info(`getOperationType ok! ${JSON.stringify(data)}`); 1329 }).catch((err: BusinessError) => { 1330 console.error(`getOperationType failed! ${err.code} ${err.message}`); 1331 }); 1332 } catch(err){ 1333 console.error(`getOperationType failed! ${err.code} ${err.message}`); 1334 } 1335} 1336try { 1337 WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); 1338} catch(err) { 1339 console.error(`getWantAgent failed! ${err.code} ${err.message}`); 1340} 1341``` 1342 1343## WantAgentFlags 1344 1345**System capability**: SystemCapability.Ability.AbilityRuntime.Core 1346 1347| Name | Value | Description | 1348| ------------------- | -------------- |-------------------------------------------------------------------------| 1349| ONE_TIME_FLAG | 0 | The **WantAgent** object can be used only once. | 1350| NO_BUILD_FLAG | 1 | The **WantAgent** object does not exist and hence it is not created. In this case, **null** is returned. | 1351| CANCEL_PRESENT_FLAG | 2 | The existing **WantAgent** object should be canceled before a new object is generated. | 1352| UPDATE_PRESENT_FLAG | 3 | Extra information of the existing **WantAgent** object is replaced with that of the new object. | 1353| CONSTANT_FLAG | 4 | The **WantAgent** object is immutable. | 1354| REPLACE_ELEMENT | 5 | The **element** attribute in the current Want can be replaced by the **element** attribute in the Want passed in **WantAgent.trigger()**. This processing is not supported yet. | 1355| REPLACE_ACTION | 6 | The **action** attribute in the current Want can be replaced by the **action** attribute in the Want passed in **WantAgent.trigger()**. This processing is not supported yet. | 1356| REPLACE_URI | 7 | The **uri** attribute in the current Want can be replaced by the **uri** attribute in the Want passed in **WantAgent.trigger()**. This processing is not supported yet. | 1357| REPLACE_ENTITIES | 8 | The **entities** attribute in the current Want can be replaced by the **entities** attribute in the Want passed in **WantAgent.trigger()**. This processing is not supported yet. | 1358| REPLACE_BUNDLE | 9 | The **bundleName** attribute in the current Want can be replaced by the **bundleName** attribute in the Want passed in **WantAgent.trigger()**. This processing is not supported yet.| 1359 1360 1361 1362## OperationType 1363 1364**System capability**: SystemCapability.Ability.AbilityRuntime.Core 1365 1366| Name | Value | Description | 1367| ----------------- | ------------- | ------------------------- | 1368| UNKNOWN_TYPE | 0 | Unknown operation type. | 1369| START_ABILITY | 1 | Starts an ability with a UI.| 1370| START_ABILITIES | 2 | Starts multiple abilities with a UI.| 1371| START_SERVICE | 3 | Starts an ability without a UI.| 1372| SEND_COMMON_EVENT | 4 | Sends a common event. | 1373 1374 1375 1376## CompleteData 1377 1378**System capability**: SystemCapability.Ability.AbilityRuntime.Core 1379 1380| Name | Type | Mandatory| Description | 1381| -------------- | ------------------------------ | ---- | ---------------------- | 1382| info | WantAgent | Yes | A triggered **WantAgent** object. | 1383| want | [Want](js-apis-app-ability-want.md#attributes) | Yes | An existing triggered Want. | 1384| finalCode | number | Yes | Request code that triggers the **WantAgent** object.| 1385| finalData | string | Yes | Final data collected by the common event. | 1386| extraInfo | Record\<string, Object> | No | Extra information. | 1387