1# Want 2 3The **Want** module provides the basic communication component of the system. 4 5> **NOTE** 6> 7> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. 8 9## Modules to Import 10 11``` 12import Want from '@ohos.application.Want'; 13``` 14 15## Attributes 16 17**System capability**: SystemCapability.Ability.AbilityBase 18 19| Name | Readable/Writable| Type | Mandatory| Description | 20| ----------- | -------- | -------------------- | ---- | ------------------------------------------------------------ | 21| deviceId | Read only | string | No | ID of the device running the ability. | 22| bundleName | Read only | string | No | Bundle name of the ability. If both **bundleName** and **abilityName** are specified in a **Want** object, the **Want** object can match a specific ability.| 23| abilityName | Read only | string | No | Name of the ability. If both **bundleName** and **abilityName** are specified in a **Want** object, the **Want** object can match a specific ability.| 24| uri | Read only | string | No | URI information to match. If **uri** is specified in a **Want** object, the **Want** object will match the specified URI information, including **scheme**, **schemeSpecificPart**, **authority**, and **path**.| 25| type | Read only | string | No | MIME type, for example, **text/plain** or **image/***. | 26| flags | Read only | number | No | How the **Want** object will be handled. For details, see [flags](js-apis-featureAbility.md#flags).| 27| action | Read only | string | No | Action option. | 28| parameters | Read only | {[key: string]: any} | No | List of parameters in the **Want** object. | 29| entities | Read only | Array\<string> | No | List of entities. | 30| extensionAbilityType<sup>9+</sup> | Read only | bundle.ExtensionAbilityType | No | Type of the Extension ability. | 31| extensionAbilityName<sup>9+<sup> | Read only | string | No | Description of the Extension ability name in the **Want** object. | 32 33**Example** 34 35- Basic usage 36 37 ```js 38 var want = { 39 "deviceId": "", // An empty deviceId indicates the local device. 40 "bundleName": "com.extreme.test", 41 "abilityName": "MainAbility", 42 "uri": "pages/second" // uri is optional and can be used to pass the destination URI. 43 }; 44 this.context.startAbility(want, (error) => { 45 // Start an ability explicitly. The bundleName, abilityName, and moduleName parameters work together to uniquely identify an ability. 46 console.log("error.code = " + error.code) 47 }) 48 ``` 49 50- Passing a file descriptor (FD) 51 52 ```js 53 var fd; 54 try { 55 fd = fileio.openSync("/data/storage/el2/base/haps/pic.png"); 56 } catch(e) { 57 console.log("openSync fail:" + JSON.stringify(e)); 58 } 59 var want = { 60 "deviceId": "", // An empty deviceId indicates the local device. 61 "bundleName": "com.extreme.test", 62 "abilityName": "MainAbility", 63 "parameters": { 64 "keyFd":{"type":"FD", "value":fd} 65 } 66 }; 67 this.context.startAbility(want, (error) => { 68 // Start an ability explicitly. The bundleName, abilityName, and moduleName parameters work together to uniquely identify an ability. 69 console.log("error.code = " + error.code) 70 }) 71 ``` 72 73