@ohos.app.ability.common (Context)

The Common module provides all level-2 module APIs for developers to export.

NOTE

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. The APIs of this module can be used only in the stage model.

Modules to Import

import common from '@ohos.app.ability.common';

System capability: SystemCapability.Ability.AbilityBase

Name Type Description
UIAbilityContext UIAbilityContext Level-2 module UIAbilityContext.
AbilityStageContext AbilityStageContext Level-2 module AbilityStageContext.
ApplicationContext ApplicationContext Level-2 module ApplicationContext.
BaseContext BaseContext Level-2 module BaseContext.
Context Context Level-2 module Context.
ExtensionContext ExtensionContext Level-2 module ExtensionContext.
FormExtensionContext FormExtensionContext Level-2 module FormExtensionContext.
ServiceExtensionContext ServiceExtensionContext Level-2 module ServiceExtensionContext.
EventHub EventHub Level-2 module EventHub.
PacMap PacMap Level-2 module PacMap.
AbilityResult AbilityResult Level-2 module AbilityResult.
ConnectOptions ConnectOptions Level-2 module ConnectOptions.

Example

import common from '@ohos.app.ability.common';

let uiAbilityContext: common.UIAbilityContext;
let abilityStageContext: common.AbilityStageContext;
let applicationContext: common.ApplicationContext;
let baseContext: common.BaseContext;
let context: common.Context;
let extensionContext: common.ExtensionContext;
let formExtensionContext: common.FormExtensionContext;
let eventHub: common.EventHub;
let pacMap: common.PacMap;
let abilityResult: common.AbilityResult;
let connectOptions: common.ConnectOptions;