• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# @ohos.app.ability.wantAgent (WantAgent模块)
2
3app.ability.WantAgent模块提供了创建WantAgent实例、获取实例的用户ID、获取want信息、比较WantAgent实例和获取bundle名称等能力。该模块将会取代[@ohos.wantAgent](js-apis-wantAgent.md)模块,建议优先使用本模块。
4
5> **说明:**
6>
7> 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
8
9## 导入模块
10
11```ts
12import WantAgent from '@ohos.app.ability.wantAgent';
13```
14
15## WantAgent.getWantAgent
16
17getWantAgent(info: WantAgentInfo, callback: AsyncCallback\<WantAgent\>): void
18
19创建WantAgent(callback形式)。 创建失败返回的WantAgent为空值。
20
21**系统能力**:SystemCapability.Ability.AbilityRuntime.Core
22
23**参数:**
24
25| 参数名     | 类型                       | 必填 | 说明                    |
26| -------- | -------------------------- | ---- | ----------------------- |
27| info     | [WantAgentInfo](js-apis-inner-wantAgent-wantAgentInfo.md)              | 是   | WantAgent信息。           |
28| callback | AsyncCallback\<WantAgent\> | 是   | 创建WantAgent的回调方法。 |
29
30**错误码:**
31
32| 错误码ID    | 错误信息            |
33|-----------|--------------------|
34| 16000007   | Service busy, there are concurrent tasks, waiting for retry.|
35| 16000151   | Invalid wantagent object.|
36
37错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)
38
39**示例:**
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对象
47let wantAgent: _WantAgent;
48//WantAgentInfo对象
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回调
77function getWantAgentCallback(err: BusinessError, data: _WantAgent) {
78    if (err === undefined) {
79        wantAgent = data;
80    } else {
81        console.error(`getWantAgent failed, error: ${JSON.stringify(err)}`);
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
97创建WantAgent(Promise形式)。 创建失败返回的WantAgent为空值。
98
99**系统能力**:SystemCapability.Ability.AbilityRuntime.Core
100
101**参数:**
102
103| 参数名 | 类型          | 必填 | 说明          |
104| ---- | ------------- | ---- | ------------- |
105| info | [WantAgentInfo](js-apis-inner-wantAgent-wantAgentInfo.md) | 是   | WantAgent信息。 |
106
107**返回值:**
108
109| 类型                                                        | 说明                                                         |
110| ----------------------------------------------------------- | ------------------------------------------------------------ |
111| Promise\<WantAgent\> | 以Promise形式返回WantAgent。 |
112
113**错误码:**
114
115| 错误码ID    | 错误信息            |
116|-----------|--------------------|
117| 16000007   | Service busy, there are concurrent tasks, waiting for retry.|
118| 16000151   | Invalid wantagent object.|
119
120错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)
121
122**示例:**
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对象
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! ${err.code} ${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
175获取WantAgent实例的包名(callback形式)。
176
177**系统能力**:SystemCapability.Ability.AbilityRuntime.Core
178
179**参数:**
180
181| 参数名     | 类型                    | 必填 | 说明                              |
182| -------- | ----------------------- | ---- | --------------------------------- |
183| agent    | WantAgent               | 是   | WantAgent对象。                     |
184| callback | AsyncCallback\<string\> | 是   | 获取WantAgent实例的包名的回调方法。 |
185
186**错误码:**
187
188| 错误码ID    | 错误信息            |
189|-----------|--------------------|
190| 16000007   | Service busy, there are concurrent tasks, waiting for retry.|
191| 16000151   | Invalid wantagent object.|
192
193错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)
194
195**示例:**
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对象
203let wantAgent: _WantAgent;
204//WantAgentInfo对象
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回调
233function getWantAgentCallback(err: BusinessError, data: _WantAgent) {
234    if (err === undefined) {
235        wantAgent = data;
236    } else {
237        console.error(`getWantAgent failed ${JSON.stringify(wantAgent)}`);
238    }
239    //getBundleName回调
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
266获取WantAgent实例的包名(Promise形式)。
267
268**系统能力**:SystemCapability.Ability.AbilityRuntime.Core
269
270**参数:**
271
272| 参数名  | 类型      | 必填 | 说明          |
273| ----- | --------- | ---- | ------------- |
274| agent | WantAgent | 是   | WantAgent对象。 |
275
276**返回值:**
277
278| 类型                                                        | 说明                                                         |
279| ----------------------------------------------------------- | ------------------------------------------------------------ |
280| Promise\<string\> | 以Promise形式返回获取WantAgent实例的包名。 |
281
282**错误码:**
283
284| 错误码ID    | 错误信息            |
285|-----------|--------------------|
286| 16000007   | Service busy, there are concurrent tasks, waiting for retry.|
287| 16000151   | Invalid wantagent object.|
288
289错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)
290
291**示例:**
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对象
299let wantAgent: _WantAgent;
300//WantAgentInfo对象
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回调
329function getWantAgentCallback(err: BusinessError, data: _WantAgent) {
330    if (err === undefined) {
331        wantAgent = data;
332    } else {
333        console.error(`getWantAgent failed! ${JSON.stringify(wantAgent)}`);
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
358获取WantAgent实例的用户ID(callback形式)。
359
360**系统能力**:SystemCapability.Ability.AbilityRuntime.Core
361
362**参数:**
363
364| 参数名     | 类型                    | 必填 | 说明                                |
365| -------- | ----------------------- | ---- | ----------------------------------- |
366| agent    | WantAgent               | 是   | WantAgent对象。                       |
367| callback | AsyncCallback\<number\> | 是   | 获取WantAgent实例的用户ID的回调方法。 |
368
369**错误码:**
370
371| 错误码ID    | 错误信息            |
372|-----------|--------------------|
373| 16000007   | Service busy, there are concurrent tasks, waiting for retry.|
374| 16000151   | Invalid wantagent object.|
375
376错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)
377
378**示例:**
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对象
386let wantAgent: _WantAgent;
387//WantAgentInfo对象
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回调
416function getWantAgentCallback(err: BusinessError, data: _WantAgent) {
417    if (err === undefined) {
418        wantAgent = data;
419    } else {
420        console.info(`getWantAgent failed ${JSON.stringify(err)}`);
421    }
422    //getUid回调
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
449获取WantAgent实例的用户ID(Promise形式)。
450
451**系统能力**:SystemCapability.Ability.AbilityRuntime.Core
452
453**参数:**
454
455| 参数名  | 类型      | 必填 | 说明          |
456| ----- | --------- | ---- | ------------- |
457| agent | WantAgent | 是   | WantAgent对象。 |
458
459**返回值:**
460
461| 类型                                                        | 说明                                                         |
462| ----------------------------------------------------------- | ------------------------------------------------------------ |
463| Promise\<number\> | 以Promise形式返回获取WantAgent实例的用户ID。 |
464
465**错误码:**
466
467| 错误码ID    | 错误信息            |
468|-----------|--------------------|
469| 16000007   | Service busy, there are concurrent tasks, waiting for retry.|
470| 16000151   | Invalid wantagent object.|
471
472错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)
473
474**示例:**
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对象
482let wantAgent: _WantAgent;
483//WantAgentInfo对象
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回调
512function getWantAgentCallback(err: BusinessError, data: _WantAgent) {
513    if (err === undefined) {
514        wantAgent = data;
515    } else {
516        console.error(`getWantAgent failed! ${JSON.stringify(wantAgent)}`);
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
540获取WantAgent对象的want(callback形式)。
541
542**系统能力**:SystemCapability.Ability.AbilityRuntime.Core
543
544**系统API**: 此接口为系统接口,三方应用不支持调用。
545
546**参数:**
547
548| 参数名     | 类型                  | 必填 | 说明                            |
549| -------- | --------------------- | ---- | ------------------------------- |
550| agent    | WantAgent             | 是   | WantAgent对象。                   |
551| callback | AsyncCallback\<[Want](js-apis-app-ability-want.md)\> | 是   | 获取WantAgent对象want的回调方法。 |
552
553**错误码:**
554
555| 错误码ID    | 错误信息            |
556|-----------|--------------------|
557| 16000007   | Service busy, there are concurrent tasks, waiting for retry.|
558| 16000015   | Service timeout.|
559| 16000151   | Invalid wantagent object.|
560
561错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)
562
563**示例:**
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对象
571let wantAgent: _WantAgent;
572//WantAgentInfo对象
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回调
601function getWantAgentCallback(err: BusinessError, data: _WantAgent) {
602    if (err === undefined) {
603        wantAgent = data;
604    } else {
605        console.error(`getWantAgent failed ${JSON.stringify(wantAgent)}`);
606    }
607    //getWant回调
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
634获取WantAgent对象的want(Promise形式)。
635
636**系统能力**:SystemCapability.Ability.AbilityRuntime.Core
637
638**系统API**: 此接口为系统接口,三方应用不支持调用。
639
640**参数:**
641
642| 参数名  | 类型      | 必填 | 说明          |
643| ----- | --------- | ---- | ------------- |
644| agent | WantAgent | 是   | WantAgent对象。 |
645
646**返回值:**
647
648| 类型                                                        | 说明                                                         |
649| ----------------------------------------------------------- | ------------------------------------------------------------ |
650| Promise\<[Want](js-apis-app-ability-want.md)\> | 以Promise形式返回获取WantAgent对象的want。 |
651
652**错误码:**
653
654| 错误码ID    | 错误信息            |
655|-----------|--------------------|
656| 16000007   | Service busy, there are concurrent tasks, waiting for retry.|
657| 16000015   | Service timeout.|
658| 16000151   | Invalid wantagent object.|
659
660错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)
661
662**示例:**
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对象
670let wantAgent: _WantAgent;
671//WantAgentInfo对象
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回调
700function getWantAgentCallback(err: BusinessError, data: _WantAgent) {
701    if (err === undefined) {
702        wantAgent = data;
703    } else {
704        console.error(`getWantAgent failed! ${JSON.stringify(wantAgent)}`);
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
729取消WantAgent实例(callback形式)。
730
731**系统能力**:SystemCapability.Ability.AbilityRuntime.Core
732
733**参数:**
734
735| 参数名     | 类型                  | 必填 | 说明                        |
736| -------- | --------------------- | ---- | --------------------------- |
737| agent    | WantAgent             | 是   | WantAgent对象。               |
738| callback | AsyncCallback\<void\> | 是   | 取消WantAgent实例的回调方法。 |
739
740**错误码:**
741
742| 错误码ID    | 错误信息            |
743|-----------|--------------------|
744| 16000007   | Service busy, there are concurrent tasks, waiting for retry.|
745| 16000151   | Invalid wantagent object.|
746
747错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)
748
749**示例:**
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对象
757let wantAgent: _WantAgent;
758//WantAgentInfo对象
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回调
787function getWantAgentCallback(err: BusinessError, data: _WantAgent) {
788    if (err === undefined) {
789        wantAgent = data;
790    } else {
791        console.error(`getWantAgent failed ${JSON.stringify(wantAgent)}`);
792    }
793    //cancel回调
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
820取消WantAgent实例(Promise形式)。
821
822**系统能力**:SystemCapability.Ability.AbilityRuntime.Core
823
824**参数:**
825
826| 参数名  | 类型      | 必填 | 说明          |
827| ----- | --------- | ---- | ------------- |
828| agent | WantAgent | 是   | WantAgent对象。 |
829
830**返回值:**
831
832| 类型            | 说明                            |
833| --------------- | ------------------------------- |
834| Promise\<void\> | 以Promise形式获取异步返回结果。 |
835
836**错误码:**
837
838| 错误码ID    | 错误信息            |
839|-----------|--------------------|
840| 16000007   | Service busy, there are concurrent tasks, waiting for retry.|
841| 16000151   | Invalid wantagent object.|
842
843错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)
844
845**示例:**
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对象
853let wantAgent: _WantAgent;
854//WantAgentInfo对象
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回调
883function getWantAgentCallback(err: BusinessError, data: _WantAgent) {
884    if (err === undefined) {
885        wantAgent = data;
886    } else {
887        console.error(`getWantAgent failed! ${JSON.stringify(wantAgent)}`);
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
910主动激发WantAgent实例(callback形式)。
911
912**系统能力**:SystemCapability.Ability.AbilityRuntime.Core
913
914**参数:**
915
916| 参数名        | 类型                          | 必填 | 说明                            |
917| ----------- | ----------------------------- | ---- | ------------------------------- |
918| agent       | WantAgent                     | 是   | WantAgent对象。                   |
919| triggerInfo | [TriggerInfo](js-apis-inner-wantAgent-triggerInfo.md)                   | 是   | TriggerInfo对象。                 |
920| callback    | AsyncCallback\<[CompleteData](#completedata)\> | 否   | 主动激发WantAgent实例的回调方法。 |
921
922**示例:**
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对象
930let wantAgent: _WantAgent;
931// triggerInfo
932let triggerInfo: WantAgent.TriggerInfo = {
933    code: 0 //自定义义结果码
934};
935//WantAgentInfo对象
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回调
964function getWantAgentCallback(err: BusinessError, data: _WantAgent) {
965    if (err === undefined) {
966        wantAgent = data;
967    } else {
968        console.error(`getWantAgent failed ${JSON.stringify(wantAgent)}`);
969    }
970    //trigger回调
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
997判断两个WantAgent实例是否相等(Callback形式),以此来判断是否是来自同一应用的相同操作。
998
999**系统能力**:SystemCapability.Ability.AbilityRuntime.Core
1000
1001**参数:**
1002
1003| 参数名       | 类型                     | 必填 | 说明                                    |
1004| ---------- | ------------------------ | ---- | --------------------------------------- |
1005| agent      | WantAgent                | 是   | WantAgent对象。                           |
1006| otherAgent | WantAgent                | 是   | WantAgent对象。                           |
1007| callback   | AsyncCallback\<boolean\> | 是   | 判断两个WantAgent实例是否相等的回调方法。 |
1008
1009**示例:**
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对象
1017let wantAgent1: _WantAgent;
1018let wantAgent2: _WantAgent;
1019//WantAgentInfo对象
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回调
1048function getWantAgentCallback(err: BusinessError, data: _WantAgent) {
1049    if (err === undefined) {
1050        wantAgent1 = data;
1051        wantAgent2 = data;
1052    } else {
1053        console.error(`getWantAgent failed ${JSON.stringify(wantAgent)}`);
1054    }
1055    //equal回调
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
1082判断两个WantAgent实例是否相等(Promise形式),以此来判断是否是来自同一应用的相同操作。
1083
1084**系统能力**:SystemCapability.Ability.AbilityRuntime.Core
1085
1086**参数:**
1087
1088| 参数名       | 类型      | 必填 | 说明          |
1089| ---------- | --------- | ---- | ------------- |
1090| agent      | WantAgent | 是   | WantAgent对象。 |
1091| otherAgent | WantAgent | 是   | WantAgent对象。 |
1092
1093**返回值:**
1094
1095| 类型                                                        | 说明                                                         |
1096| ----------------------------------------------------------- | ------------------------------------------------------------ |
1097| Promise\<boolean\> | 以Promise形式返回获取判断两个WantAgent实例是否相等的结果。 |
1098
1099**示例:**
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对象
1107let wantAgent1: _WantAgent;
1108let wantAgent2: _WantAgent;
1109//WantAgentInfo对象
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回调
1138function getWantAgentCallback(err: BusinessError, data: _WantAgent) {
1139    if (err === undefined) {
1140        wantAgent1 = data;
1141        wantAgent2 = data;
1142    } else {
1143        console.error(`getWantAgent failed! ${JSON.stringify(wantAgent)}`);
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
1166获取一个WantAgent的OperationType信息(callback形式)。
1167
1168**系统能力**:SystemCapability.Ability.AbilityRuntime.Core
1169
1170**参数:**
1171
1172| 参数名       | 类型                     | 必填 | 说明                                    |
1173| ---------- | ------------------------ | ---- | --------------------------------------- |
1174| agent      | WantAgent                | 是   | WantAgent对象。                           |
1175| callback   | AsyncCallback\<number> | 是   | 获取一个WantAgent的OperationType信息的回调方法。 |
1176
1177**错误码:**
1178
1179| 错误码ID    | 错误信息            |
1180|-----------|--------------------|
1181| 16000007   | Service busy, there are concurrent tasks, waiting for retry.|
1182| 16000015   | Service timeout.|
1183| 16000151   | Invalid wantagent object.|
1184
1185错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)
1186
1187**示例:**
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对象
1195let wantAgent: _WantAgent;
1196//WantAgentInfo对象
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回调
1225function getWantAgentCallback(err: BusinessError, data: _WantAgent) {
1226    if (err === undefined) {
1227        wantAgent = data;
1228    } else {
1229        console.error(`getWantAgent failed ${JSON.stringify(wantAgent)}`);
1230    }
1231    //getOperationTypeCallback回调
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
1256获取一个WantAgent的OperationType信息(Promise形式)。
1257
1258**系统能力**:SystemCapability.Ability.AbilityRuntime.Core
1259
1260**参数:**
1261
1262| 参数名       | 类型      | 必填 | 说明          |
1263| ---------- | --------- | ---- | ------------- |
1264| agent      | WantAgent | 是   | WantAgent对象。 |
1265
1266**返回值:**
1267
1268| 类型                                                        | 说明                                                         |
1269| ----------------------------------------------------------- | ------------------------------------------------------------ |
1270| Promise\<number> | 以Promise形式返回获取operationType的结果。 |
1271
1272**错误码:**
1273
1274| 错误码ID    | 错误信息            |
1275|-----------|--------------------|
1276| 16000007   | Service busy, there are concurrent tasks, waiting for retry.|
1277| 16000015   | Service timeout.|
1278| 16000151   | Invalid wantagent object.|
1279
1280错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)
1281
1282**示例:**
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对象
1290let wantAgent: _WantAgent;
1291//WantAgentInfo对象
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回调
1320function getWantAgentCallback(err: BusinessError, data: _WantAgent) {
1321    if (err === undefined) {
1322        wantAgent = data;
1323    } else {
1324        console.error(`getWantAgent failed! ${JSON.stringify(wantAgent)}`);
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**系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Core
1346
1347| 名称                | 值             | 说明                                                                    |
1348| ------------------- | -------------- |-----------------------------------------------------------------------|
1349| ONE_TIME_FLAG       | 0 | WantAgent仅能使用一次。                                                      |
1350| NO_BUILD_FLAG       | 1 | 如果描述WantAgent对象不存在,则不创建它,直接返回null。                                    |
1351| CANCEL_PRESENT_FLAG | 2 | 在生成一个新的WantAgent对象前取消已存在的一个WantAgent对象。                               |
1352| UPDATE_PRESENT_FLAG | 3 | 使用新的WantAgent的额外数据替换已存在的WantAgent中的额外数据。                              |
1353| CONSTANT_FLAG       | 4 | WantAgent是不可变的。                                                       |
1354| REPLACE_ELEMENT     | 5 | 当前Want中的element属性可被WantAgent.trigger()中Want的element属性取代,当前版本暂不支持。     |
1355| REPLACE_ACTION      | 6 | 当前Want中的action属性可被WantAgent.trigger()中Want的action属性取代,当前版本暂不支持。       |
1356| REPLACE_URI         | 7 | 当前Want中的uri属性可被WantAgent.trigger()中Want的uri属性取代,当前版本暂不支持。             |
1357| REPLACE_ENTITIES    | 8 | 当前Want中的entities属性可被WantAgent.trigger()中Want的entities属性取代,当前版本暂不支持。   |
1358| REPLACE_BUNDLE      | 9 | 当前Want中的bundleName属性可被WantAgent.trigger()中Want的bundleName属性取代,当前版本暂不支持。 |
1359
1360
1361
1362## OperationType
1363
1364**系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Core
1365
1366| 名称              | 值            | 说明                      |
1367| ----------------- | ------------- | ------------------------- |
1368| UNKNOWN_TYPE      | 0 | 不识别的类型。            |
1369| START_ABILITY     | 1 | 开启一个有页面的Ability。 |
1370| START_ABILITIES   | 2 | 开启多个有页面的Ability。 |
1371| START_SERVICE     | 3 | 开启一个无页面的ability。 |
1372| SEND_COMMON_EVENT | 4 | 发送一个公共事件。        |
1373
1374
1375
1376## CompleteData
1377
1378**系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Core
1379
1380| 名称           | 类型                           | 必填 | 说明                    |
1381| -------------- | ------------------------------ | ---- | ---------------------- |
1382| info           | WantAgent                       | 是   | 触发的wantAgent。       |
1383| want           | Want                            | 是   | 存在的被触发的want。     |
1384| finalCode      | number                          | 是   | 触发wantAgent的请求代码。|
1385| finalData      | string                          | 是   | 公共事件收集的最终数据。  |
1386| extraInfo      | {[key: string]: any}            | 否   | 额外数据。               |
1387
1388