js-apis-Context.md 17.0 KB
Newer Older
W
wusongqing 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
# Context Module

## Modules to Import

```js
import featureAbility from '@ohos.ability.featureAbility'
import bundle from '@ohos.bundle'
```

The **Context** object is created in a **featureAbility** and returned through its **getContext()** method. Therefore, you must import the **@ohos.ability.featureAbility** package before using the Context module. An example is as follows:

```js
import featureAbility from '@ohos.ability.featureAbility'
var context = featureAbility.getContext();
context.getOrCreateLocalDir()
```

W
wusongqing 已提交
18
## Context
W
wusongqing 已提交
19

W
wusongqing 已提交
20
### getOrCreateLocalDir
W
wusongqing 已提交
21

W
wusongqing 已提交
22
getOrCreateLocalDir(callback: AsyncCallback\<string>): void
W
wusongqing 已提交
23

W
wusongqing 已提交
24
Obtains the local root directory of the application. This method uses a callback to return the result.
W
wusongqing 已提交
25

W
wusongqing 已提交
26
If this method is called for the first time, a root directory is created.
W
wusongqing 已提交
27

W
wusongqing 已提交
28 29 30 31
**System capabilities**

SystemCapability.Ability.AbilityRuntime.Core

W
wusongqing 已提交
32
**Parameters**
W
wusongqing 已提交
33 34


W
wusongqing 已提交
35
| Name    | Type                  | Mandatory| Description                      |
W
wusongqing 已提交
36
| -------- | ---------------------- | ---- | -------------------------- |
W
wusongqing 已提交
37
| callback | AsyncCallback\<string> | Yes  | Callback used to return the local root directory of the application.|
W
wusongqing 已提交
38

W
wusongqing 已提交
39
**Example**
W
wusongqing 已提交
40 41 42 43 44 45 46 47 48 49 50

```js
import featureAbility from '@ohos.ability.featureAbility'
var context = featureAbility.getContext();
context.getOrCreateLocalDir((err, data)=>{
    console.info("data=" + data);
})
```



W
wusongqing 已提交
51
### getOrCreateLocalDir
W
wusongqing 已提交
52

W
wusongqing 已提交
53
getOrCreateLocalDir(): Promise\<string>
W
wusongqing 已提交
54

W
wusongqing 已提交
55
Obtains the local root directory of the application. This method uses a promise to return the result.
W
wusongqing 已提交
56

W
wusongqing 已提交
57
If this method is called for the first time, a root directory is created.
W
wusongqing 已提交
58

W
wusongqing 已提交
59 60 61 62
**System capabilities**

SystemCapability.Ability.AbilityRuntime.Core

W
wusongqing 已提交
63
**Return value**
W
wusongqing 已提交
64

W
wusongqing 已提交
65
| Type            | Description                  |
W
wusongqing 已提交
66
| ---------------- | ---------------------- |
W
wusongqing 已提交
67
| Promise\<string> | Promise used to return the local root directory of the application.|
W
wusongqing 已提交
68

W
wusongqing 已提交
69
**Example**
W
wusongqing 已提交
70 71 72 73

```js
import featureAbility from '@ohos.ability.featureAbility'
var context = featureAbility.getContext();
W
wusongqing 已提交
74 75
context.getOrCreateLocalDir().then((data) => {
    console.info("data=" + data);
W
wusongqing 已提交
76 77 78 79 80
});
```



W
wusongqing 已提交
81
### verifyPermission
W
wusongqing 已提交
82

W
wusongqing 已提交
83
verifyPermission(permission: string, options: PermissionOptions, callback: AsyncCallback\<number>): void
W
wusongqing 已提交
84

W
wusongqing 已提交
85
Verifies whether a specific PID and UID have the given permission. This method uses a callback to return the result.
W
wusongqing 已提交
86

W
wusongqing 已提交
87 88 89 90
**System capabilities**

SystemCapability.Ability.AbilityRuntime.Core

W
wusongqing 已提交
91
**Parameters**
W
wusongqing 已提交
92 93


W
wusongqing 已提交
94
| Name      | Type                                   | Mandatory| Description                                 |
W
wusongqing 已提交
95
| ---------- | --------------------------------------- | ---- | ------------------------------------- |
W
wusongqing 已提交
96 97 98
| permission | string                                  | Yes  | Name of the permission to verify.                     |
| options    | [PermissionOptions](#permissionoptions) | Yes  | Permission options.                           |
| callback   | AsyncCallback\<number>                  | Yes  | Callback used to return the permission verification result. The value **0** indicates that the PID and UID have the given permission, and the value **-1** indicates that the PID and UID do not have the given permission.|
W
wusongqing 已提交
99

W
wusongqing 已提交
100
**Example**
W
wusongqing 已提交
101 102 103 104 105

```js
import featureAbility from '@ohos.ability.featureAbility'
import bundle from '@ohos.bundle'
var context = featureAbility.getContext();
W
wusongqing 已提交
106 107 108
bundle.getBundleInfo('com.context.test', 1, (datainfo) =>{
	context.verifyPermission("com.example.permission", datainfo.uid);
});
W
wusongqing 已提交
109 110 111 112
```



W
wusongqing 已提交
113
### verifyPermission
W
wusongqing 已提交
114

W
wusongqing 已提交
115
verifyPermission(permission: string, callback: AsyncCallback\<number>): void
W
wusongqing 已提交
116

W
wusongqing 已提交
117
Verifies whether the current PID and UID have the given permission. This method uses a callback to return the result.
W
wusongqing 已提交
118

W
wusongqing 已提交
119
**Parameters**
W
wusongqing 已提交
120 121


W
wusongqing 已提交
122
| Name      | Type                  | Mandatory| Description                                 |
W
wusongqing 已提交
123
| ---------- | ---------------------- | ---- | ------------------------------------- |
W
wusongqing 已提交
124 125
| permission | string                 | Yes  | Name of the permission to verify.                     |
| callback   | AsyncCallback\<number> | Yes  | Callback used to return the permission verification result. The value **0** indicates that the PID and UID have the given permission, and the value **-1** indicates that the PID and UID do not have the given permission.|
W
wusongqing 已提交
126

W
wusongqing 已提交
127
**Example**
W
wusongqing 已提交
128 129 130 131 132 133 134

```js
import featureAbility from '@ohos.ability.featureAbility'
var context = featureAbility.getContext();
context.verifyPermission("com.example.permission")
```

W
wusongqing 已提交
135
### verifyPermission
W
wusongqing 已提交
136

W
wusongqing 已提交
137
verifyPermission(permission: string, options?: PermissionOptions): Promise\<number>
W
wusongqing 已提交
138

W
wusongqing 已提交
139
Verifies whether a specific PID and UID have the given permission. This method uses a promise to return the result.
W
wusongqing 已提交
140

W
wusongqing 已提交
141 142 143 144
**System capabilities**

SystemCapability.Ability.AbilityRuntime.Core

W
wusongqing 已提交
145
**Parameters**
W
wusongqing 已提交
146 147


W
wusongqing 已提交
148
| Name      | Type                                   | Mandatory| Description            |
W
wusongqing 已提交
149
| ---------- | --------------------------------------- | ---- | ---------------- |
W
wusongqing 已提交
150 151
| permission | string                                  | Yes  | Name of the permission to verify.|
| options    | [PermissionOptions](#permissionoptions) | No  | Permission options.      |
W
wusongqing 已提交
152

W
wusongqing 已提交
153
**Return value**
W
wusongqing 已提交
154

W
wusongqing 已提交
155
| Type            | Description                                                       |
W
wusongqing 已提交
156 157
| ---------------- | ----------------------------------------------------------- |
| Promise\<number> | Promise used to return the permission verification result. The value **0** indicates that the PID and UID have the given permission, and the value **-1** indicates that the PID and UID do not have the given permission.|
W
wusongqing 已提交
158

W
wusongqing 已提交
159
**Example**
W
wusongqing 已提交
160 161 162 163 164

```js
import featureAbility from '@ohos.ability.featureAbility'
var context = featureAbility.getContext();
var Permission = context.PermissionOptions(1,1);
W
wusongqing 已提交
165 166 167
context.verifyPermission('com.context.permission',Permission).then((data) => {
    console.info("======================>verifyPermissionCallback====================>");
    console.info("====>data====>" + JSON.stringify(data));
W
wusongqing 已提交
168 169 170 171 172
});
```



W
wusongqing 已提交
173
### requestPermissionsFromUser
W
wusongqing 已提交
174

W
wusongqing 已提交
175
requestPermissionsFromUser(permissions: Array\<string>, requestCode: number, resultCallback: AsyncCallback<[PermissionRequestResult](#permissionrequestresult)>)
W
wusongqing 已提交
176

W
wusongqing 已提交
177
Requests certain permissions from the system. This method uses a callback to return the result.
W
wusongqing 已提交
178

W
wusongqing 已提交
179 180 181 182
**System capabilities**

SystemCapability.Ability.AbilityRuntime.Core

W
wusongqing 已提交
183
**Parameters**
W
wusongqing 已提交
184 185


W
wusongqing 已提交
186
| Name          | Type                                                        | Mandatory| Description                                           |
W
wusongqing 已提交
187
| -------------- | ------------------------------------------------------------ | ---- | ----------------------------------------------- |
W
wusongqing 已提交
188 189 190
| permissions    | Array\<string>                                               | Yes  | Permissions to request. This parameter cannot be **null**.       |
| requestCode    | number                                                       | Yes  | Request code to be passed to **PermissionRequestResult**.|
| resultCallback | AsyncCallback<[PermissionRequestResult](#permissionrequestresult)> | Yes  | Permission request result.                             |
W
wusongqing 已提交
191
**Example**
W
wusongqing 已提交
192 193 194 195

```js
import featureAbility from '@ohos.ability.featureAbility'
var context = featureAbility.getContext();
W
wusongqing 已提交
196
context.requestPermissionsFromUser(
W
wusongqing 已提交
197 198 199 200 201
    ["com.example.permission1",
     "com.example.permission2",
     "com.example.permission3",
     "com.example.permission4",
     "com.example.permission5"],
W
wusongqing 已提交
202 203 204 205
    1,(err, data)=>{
        console.info("====>requestdata====>" + JSON.stringify(data));
        console.info("====>requesterrcode====>" + JSON.stringify(err.code));
    }
W
wusongqing 已提交
206 207 208 209 210
)
```



W
wusongqing 已提交
211
### getApplicationInfo
W
wusongqing 已提交
212

W
wusongqing 已提交
213
getApplicationInfo(callback: AsyncCallback\<ApplicationInfo>)
W
wusongqing 已提交
214

W
wusongqing 已提交
215
Obtains information about the current application. This method uses a callback to return the result.
W
wusongqing 已提交
216

W
wusongqing 已提交
217 218 219 220
**System capabilities**

SystemCapability.Ability.AbilityRuntime.Core

W
wusongqing 已提交
221
**Parameters**
W
wusongqing 已提交
222

W
wusongqing 已提交
223
| Name    | Type                           | Mandatory| Description                    |
W
wusongqing 已提交
224
| -------- | ------------------------------- | ---- | ------------------------ |
W
wusongqing 已提交
225
| callback | AsyncCallback\<ApplicationInfo> | Yes  | Callback used to return the application information.|
W
wusongqing 已提交
226

W
wusongqing 已提交
227
**Example**
W
wusongqing 已提交
228 229 230 231 232 233 234 235 236

```js
import featureAbility from '@ohos.ability.featureAbility'
var context = featureAbility.getContext();
context.getApplicationInfo()
```



W
wusongqing 已提交
237
### getApplicationInfo
W
wusongqing 已提交
238

W
wusongqing 已提交
239
getApplicationInfo(): Promise\<ApplicationInfo>
W
wusongqing 已提交
240

W
wusongqing 已提交
241
Obtains information about the current application. This method uses a promise to return the result.
W
wusongqing 已提交
242

W
wusongqing 已提交
243 244 245 246
**System capabilities**

SystemCapability.Ability.AbilityRuntime.Core

W
wusongqing 已提交
247
**Return value**
W
wusongqing 已提交
248

W
wusongqing 已提交
249
| Type                     | Description              |
W
wusongqing 已提交
250 251
| ------------------------- | ------------------ |
| Promise\<ApplicationInfo> | Promise used to return the application information.|
W
wusongqing 已提交
252

W
wusongqing 已提交
253
**Example**
W
wusongqing 已提交
254 255 256 257

```js
import featureAbility from '@ohos.ability.featureAbility'
var context = featureAbility.getContext();
W
wusongqing 已提交
258 259 260
context.getApplicationInfo().then((data) => {
    console.info("=====================>getApplicationInfoCallback===================>");
    console.info("====>data====>" + JSON.stringify(data));
W
wusongqing 已提交
261 262 263 264 265
});
```



W
wusongqing 已提交
266
### getBundleName
W
wusongqing 已提交
267

W
wusongqing 已提交
268
getBundleName(callback: AsyncCallback\<string>): void
W
wusongqing 已提交
269

W
wusongqing 已提交
270
Obtains the bundle name of the current ability. This method uses a callback to return the result.
W
wusongqing 已提交
271

W
wusongqing 已提交
272 273 274 275
**System capabilities**

SystemCapability.Ability.AbilityRuntime.Core

W
wusongqing 已提交
276
**Parameters**
W
wusongqing 已提交
277

W
wusongqing 已提交
278
| Name    | Type                  | Mandatory| Description                         |
W
wusongqing 已提交
279
| -------- | ---------------------- | ---- | ----------------------------- |
W
wusongqing 已提交
280
| callback | AsyncCallback\<string> | Yes  | Callback used to return the bundle name.|
W
wusongqing 已提交
281

W
wusongqing 已提交
282
**Example**
W
wusongqing 已提交
283 284 285 286 287 288 289 290 291

```js
import featureAbility from '@ohos.ability.featureAbility'
var context = featureAbility.getContext();
context.getBundleName()
```



W
wusongqing 已提交
292
### getBundleName
W
wusongqing 已提交
293

W
wusongqing 已提交
294
getBundleName(): Promise\<string>
W
wusongqing 已提交
295

W
wusongqing 已提交
296
Obtains the bundle name of the current ability. This method uses a promise to return the result.
W
wusongqing 已提交
297

W
wusongqing 已提交
298 299 300 301
**System capabilities**

SystemCapability.Ability.AbilityRuntime.Core

W
wusongqing 已提交
302
**Return value**
W
wusongqing 已提交
303

W
wusongqing 已提交
304
| Type            | Description                     |
W
wusongqing 已提交
305 306
| ---------------- | ------------------------- |
| Promise\<string> | Promise used to return the bundle name.|
W
wusongqing 已提交
307

W
wusongqing 已提交
308
**Example**
W
wusongqing 已提交
309 310 311 312

```js
import featureAbility from '@ohos.ability.featureAbility'
var context = featureAbility.getContext();
W
wusongqing 已提交
313 314 315
context.getBundleName().then((data) => {
    console.info("=======================>getBundleNameCallback====================>");
    console.info("====>data====>" + JSON.stringify(data));
W
wusongqing 已提交
316 317 318 319 320
});
```



W
wusongqing 已提交
321
### getProcessInfo
W
wusongqing 已提交
322

W
wusongqing 已提交
323
getProcessInfo(callback: AsyncCallback\<ProcessInfo>)
W
wusongqing 已提交
324

W
wusongqing 已提交
325
Obtains information about the current process, including the PID and process name. This method uses a callback to return the result.
W
wusongqing 已提交
326

W
wusongqing 已提交
327 328 329 330
**System capabilities**

SystemCapability.Ability.AbilityRuntime.Core

W
wusongqing 已提交
331
**Parameters**
W
wusongqing 已提交
332

W
wusongqing 已提交
333
| Name    | Type                       | Mandatory| Description                |
W
wusongqing 已提交
334
| -------- | --------------------------- | ---- | -------------------- |
W
wusongqing 已提交
335
| callback | AsyncCallback\<ProcessInfo> | Yes  | Callback used to return the process information.|
W
wusongqing 已提交
336

W
wusongqing 已提交
337
**Example**
W
wusongqing 已提交
338 339 340 341 342 343 344 345 346

```js
import featureAbility from '@ohos.ability.featureAbility'
var context = featureAbility.getContext();
context.getProcessInfo()
```



W
wusongqing 已提交
347
### getProcessInfo
W
wusongqing 已提交
348

W
wusongqing 已提交
349
getProcessInfo(): Promise\<ProcessInfo>
W
wusongqing 已提交
350

W
wusongqing 已提交
351
Obtains information about the current process, including the PID and process name. This method uses a promise to return the result.
W
wusongqing 已提交
352

W
wusongqing 已提交
353 354 355 356
**System capabilities**

SystemCapability.Ability.AbilityRuntime.Core

W
wusongqing 已提交
357
**Return value**
W
wusongqing 已提交
358

W
wusongqing 已提交
359
| Type                 | Description          |
W
wusongqing 已提交
360 361
| --------------------- | -------------- |
| Promise\<ProcessInfo> | Promise used to return the process information.|
W
wusongqing 已提交
362

W
wusongqing 已提交
363
**Example**
W
wusongqing 已提交
364 365 366 367

```js
import featureAbility from '@ohos.ability.featureAbility'
var context = featureAbility.getContext();
W
wusongqing 已提交
368 369 370
context.getProcessInfo().then((data) => {
    console.info("=======================>getProcessInfoCallback====================>");
    console.info("====>data====>" + JSON.stringify(data));
W
wusongqing 已提交
371 372 373 374 375
});
```



W
wusongqing 已提交
376
### getElementName
W
wusongqing 已提交
377

W
wusongqing 已提交
378
getElementName(callback: AsyncCallback\<ElementName>): void
W
wusongqing 已提交
379

W
wusongqing 已提交
380
Obtains the **ohos.bundle.ElementName** object of the current ability. This method uses a callback to return the result.
W
wusongqing 已提交
381

W
wusongqing 已提交
382
This method is available only to Page abilities.
W
wusongqing 已提交
383

W
wusongqing 已提交
384 385 386 387
**System capabilities**

SystemCapability.Ability.AbilityRuntime.Core

W
wusongqing 已提交
388
**Parameters**
W
wusongqing 已提交
389

W
wusongqing 已提交
390
| Name    | Type                       | Mandatory| Description                                          |
W
wusongqing 已提交
391
| -------- | --------------------------- | ---- | ---------------------------------------------- |
W
wusongqing 已提交
392
| callback | AsyncCallback\<ElementName> | Yes  | Callback used to return the **ohos.bundle.ElementName** object.|
W
wusongqing 已提交
393

W
wusongqing 已提交
394
**Example**
W
wusongqing 已提交
395 396 397 398 399 400 401 402 403

```js
import featureAbility from '@ohos.ability.featureAbility'
var context = featureAbility.getContext();
context.getElementName()
```



W
wusongqing 已提交
404
### getElementName
W
wusongqing 已提交
405

W
wusongqing 已提交
406
getElementName(): Promise\<ElementName>
W
wusongqing 已提交
407

W
wusongqing 已提交
408
Obtains the **ohos.bundle.ElementName** object of the current ability. This method uses a promise to return the result.
W
wusongqing 已提交
409

W
wusongqing 已提交
410
This method is available only to Page abilities.
W
wusongqing 已提交
411

W
wusongqing 已提交
412 413 414 415
**System capabilities**

SystemCapability.Ability.AbilityRuntime.Core

W
wusongqing 已提交
416
**Return value**
W
wusongqing 已提交
417

W
wusongqing 已提交
418
| Type                 | Description                                      |
W
wusongqing 已提交
419
| --------------------- | ------------------------------------------ |
W
wusongqing 已提交
420
| Promise\<ElementName> | Promise used to return the **ohos.bundle.ElementName** object.|
W
wusongqing 已提交
421

W
wusongqing 已提交
422
**Example**
W
wusongqing 已提交
423 424 425 426

```js
import featureAbility from '@ohos.ability.featureAbility'
var context = featureAbility.getContext();
W
wusongqing 已提交
427 428 429
context.getElementName().then((data) => {
    console.info("=======================>getElementNameCallback====================>");
    console.info("====>data====>" + JSON.stringify(data));
W
wusongqing 已提交
430 431 432
});
```

W
wusongqing 已提交
433
### getProcessName
W
wusongqing 已提交
434

W
wusongqing 已提交
435
getProcessName(callback: AsyncCallback\<string>): void
W
wusongqing 已提交
436

W
wusongqing 已提交
437
Obtains the name of the current process. This method uses a callback to return the result.
W
wusongqing 已提交
438

W
wusongqing 已提交
439 440 441 442 443
**System capabilities**

SystemCapability.Ability.AbilityRuntime.Core

| Name    | Type                  | Mandatory| Description                |
W
wusongqing 已提交
444
| -------- | ---------------------- | ---- | -------------------- |
W
wusongqing 已提交
445
| callback | AsyncCallback\<string> | Yes  | Callback used to return the process name.|
W
wusongqing 已提交
446

W
wusongqing 已提交
447
**Example**
W
wusongqing 已提交
448 449 450 451 452 453 454 455 456

```js
import featureAbility from '@ohos.ability.featureAbility'
var context = featureAbility.getContext();
context.getProcessName()
```



W
wusongqing 已提交
457
### getProcessName
W
wusongqing 已提交
458

W
wusongqing 已提交
459
getProcessName(): Promise\<string>
W
wusongqing 已提交
460

W
wusongqing 已提交
461
Obtains the name of the current process. This method uses a promise to return the result.
W
wusongqing 已提交
462

W
wusongqing 已提交
463 464 465 466
**System capabilities**

SystemCapability.Ability.AbilityRuntime.Core

W
wusongqing 已提交
467
**Return value**
W
wusongqing 已提交
468

W
wusongqing 已提交
469
| Type            | Description                |
W
wusongqing 已提交
470
| ---------------- | -------------------- |
W
wusongqing 已提交
471
| Promise\<string> | Promise used to return the process name.|
W
wusongqing 已提交
472

W
wusongqing 已提交
473
**Example**
W
wusongqing 已提交
474 475 476 477

```js
import featureAbility from '@ohos.ability.featureAbility'
var context = featureAbility.getContext();
W
wusongqing 已提交
478 479 480
context.getProcessName().then((data) => {
    console.info("=======================>getProcessNameCallback====================>");
    console.info("====>data====>" + JSON.stringify(data));
W
wusongqing 已提交
481 482 483 484 485
});
```



W
wusongqing 已提交
486
### getCallingBundle
W
wusongqing 已提交
487

W
wusongqing 已提交
488
getCallingBundle(callback: AsyncCallback\<string>): void
W
wusongqing 已提交
489

W
wusongqing 已提交
490
Obtains the bundle name of the calling ability. This method uses a callback to return the result.
W
wusongqing 已提交
491

W
wusongqing 已提交
492 493 494 495
**System capabilities**

SystemCapability.Ability.AbilityRuntime.Core

W
wusongqing 已提交
496
**Parameters**
W
wusongqing 已提交
497

W
wusongqing 已提交
498
| Name    | Type                  | Mandatory| Description                     |
W
wusongqing 已提交
499
| -------- | ---------------------- | ---- | ------------------------- |
W
wusongqing 已提交
500
| callback | AsyncCallback\<string> | Yes  | Callback used to return the bundle name.|
W
wusongqing 已提交
501

W
wusongqing 已提交
502
**Example**
W
wusongqing 已提交
503 504 505 506 507 508 509 510 511

```js
import featureAbility from '@ohos.ability.featureAbility'
var context = featureAbility.getContext();
context.getCallingBundle()
```



W
wusongqing 已提交
512
### getCallingBundle
W
wusongqing 已提交
513

W
wusongqing 已提交
514
getCallingBundle(): Promise\<string>
W
wusongqing 已提交
515

W
wusongqing 已提交
516
Obtains the bundle name of the calling ability. This method uses a promise to return the result.
W
wusongqing 已提交
517

W
wusongqing 已提交
518 519 520 521
**System capabilities**

SystemCapability.Ability.AbilityRuntime.Core

W
wusongqing 已提交
522
**Return value**
W
wusongqing 已提交
523

W
wusongqing 已提交
524
| Type           | Description                     |
W
wusongqing 已提交
525 526
| --------------- | ------------------------- |
| Promise\<string> | Promise used to return the bundle name.|
W
wusongqing 已提交
527

W
wusongqing 已提交
528
**Example**
W
wusongqing 已提交
529 530 531 532

```js
import featureAbility from '@ohos.ability.featureAbility'
var context = featureAbility.getContext();
W
wusongqing 已提交
533 534 535
context.getCallingBundle().then((data) => {
    console.info("======================>getCallingBundleCallback====================>");
    console.info("====>data====>" + JSON.stringify(data));
W
wusongqing 已提交
536 537
});
```
W
wusongqing 已提交
538 539 540

## PermissionOptions

W
wusongqing 已提交
541
| Name| Readable/Writable| Type  | Mandatory| Description  |
W
wusongqing 已提交
542
| ---- | -------- | ------ | ---- | ------ |
W
wusongqing 已提交
543 544
| pid  | Read-only    | number | No  | PID.<br><b>System capabilities: </b>SystemCapability.Ability.AbilityRuntime.Core|
| uid  | Read-only    | number | No  | UID.<br><b>System capabilities: </b>SystemCapability.Ability.AbilityRuntime.Core|
W
wusongqing 已提交
545 546 547

## PermissionRequestResult

W
wusongqing 已提交
548
| Name       | Readable/Writable| Type          | Mandatory| Description              |
W
wusongqing 已提交
549
| ----------- | -------- | -------------- | ---- | ------------------ |
W
wusongqing 已提交
550 551 552
| requestCode | Read-only    | number         | Yes  | Request code passed.<br><b>System capabilities: </b>SystemCapability.Ability.AbilityRuntime.Core|
| permissions | Read-only    | Array\<string> | Yes  | Permissions passed.<br><b>System capabilities: </b>SystemCapability.Ability.AbilityRuntime.Core    |
| authResults | Read-only    | Array\<number> | Yes  | Permission request result.<br><b>System capabilities: </b>SystemCapability.Ability.AbilityRuntime.Core      |