• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# @ohos.app.ability.common (Context)
2
3You can use this module to reference the ability public module class.
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 { common } from '@kit.AbilityKit';
13```
14
15## UIAbilityContext
16
17type UIAbilityContext = _UIAbilityContext.default
18
19Defines the level-2 module UIAbilityContext.
20
21**Atomic service API**: This API can be used in atomic services since API version 11.
22
23**System capability**: SystemCapability.Ability.AbilityRuntime.Core
24
25**Model restriction**: This API can be used only in the stage model.
26
27| Type| Description|
28| --- | --- |
29| [_UIAbilityContext.default](js-apis-inner-application-uiAbilityContext.md) | Level-2 module UIAbilityContext.|
30
31## AbilityStageContext
32
33type AbilityStageContext = _AbilityStageContext.default
34
35Defines the level-2 module AbilityStageContext.
36
37**Atomic service API**: This API can be used in atomic services since API version 11.
38
39**System capability**: SystemCapability.Ability.AbilityRuntime.Core
40
41**Model restriction**: This API can be used only in the stage model.
42
43| Type| Description|
44| --- | --- |
45| [_AbilityStageContext.default](js-apis-inner-application-abilityStageContext.md) | Level-2 module AbilityStageContext.|
46
47## ApplicationContext
48
49type ApplicationContext = _ApplicationContext.default
50
51Defines the level-2 module ApplicationContext.
52
53**Atomic service API**: This API can be used in atomic services since API version 11.
54
55**System capability**: SystemCapability.Ability.AbilityRuntime.Core
56
57**Model restriction**: This API can be used only in the stage model.
58
59| Type| Description|
60| --- | --- |
61| [_ApplicationContext.default](js-apis-inner-application-applicationContext.md) | Level-2 module ApplicationContext.|
62
63## BaseContext
64
65type BaseContext = _BaseContext.default
66
67Defines the level-2 module BaseContext.
68
69**Atomic service API**: This API can be used in atomic services since API version 11.
70
71**System capability**: SystemCapability.Ability.AbilityRuntime.Core
72
73**Model restriction**: This API can be used only in the stage model.
74
75| Type| Description|
76| --- | --- |
77| [_BaseContext.default](js-apis-inner-application-baseContext.md) | Level-2 module BaseContext.|
78
79## Context
80
81type Context = _Context.default
82
83Defines the level-2 module Context.
84
85**Atomic service API**: This API can be used in atomic services since API version 11.
86
87**System capability**: SystemCapability.Ability.AbilityRuntime.Core
88
89**Model restriction**: This API can be used only in the stage model.
90
91| Type| Description|
92| --- | --- |
93| [_Context.default](js-apis-inner-application-context.md) | Level-2 module Context.|
94
95## ExtensionContext
96
97type ExtensionContext = _ExtensionContext.default
98
99Defines the level-2 module ExtensionContext.
100
101**Atomic service API**: This API can be used in atomic services since API version 11.
102
103**System capability**: SystemCapability.Ability.AbilityRuntime.Core
104
105**Model restriction**: This API can be used only in the stage model.
106
107| Type| Description|
108| --- | --- |
109| [_ExtensionContext.default](js-apis-inner-application-extensionContext.md) | Level-2 module ExtensionContext.|
110
111## FormExtensionContext
112
113type FormExtensionContext = _FormExtensionContext.default
114
115Defines the level-2 module FormExtensionContext.
116
117**Atomic service API**: This API can be used in atomic services since API version 11.
118
119**System capability**: SystemCapability.Ability.AbilityRuntime.Core
120
121**Model restriction**: This API can be used only in the stage model.
122
123| Type| Description|
124| --- | --- |
125| [_FormExtensionContext.default](../apis-form-kit/js-apis-inner-application-formExtensionContext.md) | Level-2 module FormExtensionContext.|
126
127## VpnExtensionContext<sup>11+<sup>
128
129type VpnExtensionContext = _VpnExtensionContext.default
130
131Defines the level-2 module VpnExtensionContext.
132
133**System capability**: SystemCapability.Ability.AbilityRuntime.Core
134
135**Model restriction**: This API can be used only in the stage model.
136
137| Type| Description|
138| --- | --- |
139| [_VpnExtensionContext.default](../apis-network-kit/js-apis-inner-application-VpnExtensionContext.md) | Level-2 module VpnExtensionContext.|
140
141## EventHub
142
143type EventHub = _EventHub.default
144
145Defines the level-2 module EventHub.
146
147**Atomic service API**: This API can be used in atomic services since API version 11.
148
149**System capability**: SystemCapability.Ability.AbilityRuntime.Core
150
151**Model restriction**: This API can be used only in the stage model.
152
153| Type| Description|
154| --- | --- |
155| [_EventHub.default](js-apis-inner-application-eventHub.md) | Level-2 module EventHub.|
156
157## PacMap
158
159type PacMap = _PacMap
160
161Defines the level-2 module PacMap.
162
163**Atomic service API**: This API can be used in atomic services since API version 11.
164
165**System capability**: SystemCapability.Ability.AbilityRuntime.Core
166
167| Type| Description|
168| --- | --- |
169| [_PacMap](js-apis-inner-ability-dataAbilityHelper.md#pacmap) | Level-2 module PacMap.|
170
171## AbilityResult
172
173type AbilityResult = _AbilityResult
174
175Defines the level-2 module AbilityResult.
176
177**Atomic service API**: This API can be used in atomic services since API version 11.
178
179**System capability**: SystemCapability.Ability.AbilityRuntime.Core
180
181**Model restriction**: This API can be used only in the stage model.
182
183| Type| Description|
184| --- | --- |
185| [_AbilityResult](js-apis-inner-ability-abilityResult.md) | Level-2 module AbilityResult.|
186
187## AbilityStartCallback<sup>11+<sup>
188
189type AbilityStartCallback = _AbilityStartCallback
190
191Defines the level-2 module AbilityStartCallback.
192
193**Atomic service API**: This API can be used in atomic services since API version 11.
194
195**System capability**: SystemCapability.Ability.AbilityRuntime.Core
196
197**Model restriction**: This API can be used only in the stage model.
198
199| Type| Description|
200| --- | --- |
201| [_AbilityStartCallback](js-apis-inner-application-abilityStartCallback.md) | Level-2 module AbilityStartCallback.|
202
203## ConnectOptions
204
205type ConnectOptions = _ConnectOptions
206
207Defines the level-2 module ConnectOptions.
208
209**System capability**: SystemCapability.Ability.AbilityRuntime.Core
210
211**Model restriction**: This API can be used only in the stage model.
212
213| Type| Description|
214| --- | --- |
215| [_ConnectOptions](js-apis-inner-ability-connectOptions.md) | Level-2 module ConnectOptions.|
216
217## UIExtensionContext<sup>10+</sup>
218
219type UIExtensionContext = _UIExtensionContext.default
220
221Defines the level-2 module UIExtensionContext.
222
223**System capability**: SystemCapability.Ability.AbilityRuntime.Core
224
225**Model restriction**: This API can be used only in the stage model.
226
227| Type| Description|
228| --- | --- |
229| [_UIExtensionContext.default](js-apis-inner-application-uiExtensionContext.md) | Level-2 module UIExtensionContext.|
230
231## EmbeddableUIAbilityContext<sup>12+<sup>
232
233type EmbeddableUIAbilityContext = _EmbeddableUIAbilityContext.default
234
235Defines the level-2 module EmbeddableUIAbilityContext.
236
237**Atomic service API**: This API can be used in atomic services since API version 12.
238
239**System capability**: SystemCapability.Ability.AbilityRuntime.Core
240
241**Model restriction**: This API can be used only in the stage model.
242
243| Type| Description|
244| --- | --- |
245| [_EmbeddableUIAbilityContext.default](js-apis-inner-application-EmbeddableUIAbilityContext.md) | Level-2 module EmbeddableUIAbilityContext.|
246
247## PhotoEditorExtensionContext<sup>12+<sup>
248
249type PhotoEditorExtensionContext = _PhotoEditorExtensionContext.default
250
251Defines the level-2 module PhotoEditorExtensionContext.
252
253**System capability**: SystemCapability.Ability.AppExtension.PhotoEditorExtension
254
255**Model restriction**: This API can be used only in the stage model.
256
257| Type| Description|
258| --- | --- |
259| [_PhotoEditorExtensionContext.default](js-apis-app-ability-photoEditorExtensionContext.md) | Level-2 module PhotoEditorExtensionContext.|
260
261## UIServiceProxy<sup>14+<sup>
262
263type UIServiceProxy = _UIServiceProxy.default
264
265Defines the level-2 module UIServiceProxy.
266
267**Atomic service API**: This API can be used in atomic services since API version 14.
268
269**System capability**: SystemCapability.Ability.AbilityRuntime.Core
270
271**Model restriction**: This API can be used only in the stage model.
272
273| Type| Description|
274| --- | --- |
275| [_UIServiceProxy.default](js-apis-inner-application-uiserviceproxy.md) | Level-2 module UIServiceProxy.|
276
277## UIServiceExtensionConnectCallback<sup>14+<sup>
278
279type UIServiceExtensionConnectCallback = _UIServiceExtensionConnectCallback.default
280
281Defines the level-2 module UIServiceExtensionConnectCallback.
282
283**Atomic service API**: This API can be used in atomic services since API version 14.
284
285**System capability**: SystemCapability.Ability.AbilityRuntime.Core
286
287**Model restriction**: This API can be used only in the stage model.
288
289| Type| Description|
290| --- | --- |
291| [_UIServiceExtensionConnectCallback.default](js-apis-inner-application-uiServiceExtensionconnectcallback.md) | Level-2 module UIServiceExtensionConnectCallback.|
292
293
294**Example**
295
296```ts
297import { common } from '@kit.AbilityKit';
298
299let uiAbilityContext: common.UIAbilityContext;
300let abilityStageContext: common.AbilityStageContext;
301let applicationContext: common.ApplicationContext;
302let baseContext: common.BaseContext;
303let context: common.Context;
304let uiExtensionContext: common.UIExtensionContext;
305let extensionContext: common.ExtensionContext;
306let formExtensionContext: common.FormExtensionContext;
307let vpnExtensionContext: common.VpnExtensionContext;
308let eventHub: common.EventHub;
309let pacMap: common.PacMap;
310let abilityResult: common.AbilityResult;
311let abilityStartCallback: common.AbilityStartCallback;
312let connectOptions: common.ConnectOptions;
313let embeddableUIAbilityContext: common.EmbeddableUIAbilityContext;
314let photoEditorExtensionContext: common.PhotoEditorExtensionContext;
315let uiServiceProxy : common.UIServiceProxy;
316let uiServiceExtensionConnectCallback : common.UIServiceExtensionConnectCallback;
317```
318