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