1# Context (FA Model)
2
3
4There is only one context in the FA model. All capabilities in the context are provided through methods. The context uses these methods to extend the capabilities of the **featureAbility** class.
5
6
7## Available APIs
8
9To use the context in the FA model, first import the **featureAbility** module.
10
11
12```ts
13import featureAbility from '@ohos.ability.featureAbility';
14```
15
16Then, call **getContext()** to obtain the **Context** object:
17
18
19```ts
20import featureAbility from '@ohos.ability.featureAbility';
21
22let context = featureAbility.getContext();
23```
24
25For details about the APIs, see [API Reference](../reference/apis-ability-kit/js-apis-inner-app-context.md).
26
27
28## How to Develop
29
301. Query bundle information.
31
32    ```ts
33    import featureAbility from '@ohos.ability.featureAbility';
34    import hilog from '@ohos.hilog';
35
36    const TAG: string = 'MainAbility';
37    const domain: number = 0xFF00;
38
39    class MainAbility {
40      onCreate() {
41        // Obtain the context and call related APIs.
42        let context = featureAbility.getContext();
43        context.getBundleName((data, bundleName) => {
44          hilog.info(domain, TAG, 'ability bundleName:' + bundleName);
45        });
46        hilog.info(domain, TAG, 'Application onCreate');
47      }
48      //...
49    }
50
51    export default new MainAbility();
52    ```
53
542. Set the display orientation of the **featureAbility**.
55
56    ```ts
57    import featureAbility from '@ohos.ability.featureAbility';
58    import bundle from '@ohos.bundle';
59    import hilog from '@ohos.hilog';
60
61    const TAG: string = 'PageAbilitySingleton';
62    const domain: number = 0xFF00;
63
64    class PageAbilitySingleton {
65      onCreate() {
66        // Obtain the context and call related APIs.
67        let context = featureAbility.getContext();
68        context.setDisplayOrientation(bundle.DisplayOrientation.PORTRAIT).then(() => {
69          hilog.info(domain, TAG, 'Set display orientation.');
70        })
71        hilog.info(domain, TAG, 'Application onCreate');
72      }
73
74      onDestroy() {
75        hilog.info(domain, TAG, 'Application onDestroy');
76      }
77      //...
78    }
79
80    export default new PageAbilitySingleton();
81    ```
82