1e41f4b71Sopenharmony_ci# Ability Framework Changelog
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ci## Added the saveAppState API to cl.ability.appRecovery
4e41f4b71Sopenharmony_ci
5e41f4b71Sopenharmony_ciThe API **saveAppState (context?: UIAbilityContext): boolean;** is added.
6e41f4b71Sopenharmony_ci
7e41f4b71Sopenharmony_ci**Change Impact**
8e41f4b71Sopenharmony_ci
9e41f4b71Sopenharmony_ciWhen developing an application based on OpenHarmony 4.0.5.2 or a later SDK version, you can use **saveAppState** with the ability context specified to save the state of the specified ability.
10e41f4b71Sopenharmony_ci
11e41f4b71Sopenharmony_ci**Key API/Component Changes**
12e41f4b71Sopenharmony_ci
13e41f4b71Sopenharmony_ciThe **saveAppState** API is added to the **@ohos.app.ability.appRecovery.d.ts** file.
14e41f4b71Sopenharmony_ci
15e41f4b71Sopenharmony_ci| Module| Class| Method/Attribute/Enum/Constant| Change Type|
16e41f4b71Sopenharmony_ci|  -- | -- | -- | -- |
17e41f4b71Sopenharmony_ci| @ohos.app.ability.appRecovery.d.ts | appRecovery | saveAppState(context?: UIAbilityContext): boolean; | Added|
18e41f4b71Sopenharmony_ci
19e41f4b71Sopenharmony_ci**Adaptation Guide**
20e41f4b71Sopenharmony_ci
21e41f4b71Sopenharmony_ciCall **saveAppState** with the UIAbility context specified to save the ability state.
22e41f4b71Sopenharmony_ci
23e41f4b71Sopenharmony_ci```ts
24e41f4b71Sopenharmony_ciimport appRecovery from '@ohos.app.ability.appRecovery';
25e41f4b71Sopenharmony_cionBackground() {
26e41f4b71Sopenharmony_ci    hilog.info(0x0000, '[demo]', '%{public}s', 'EntryAbility onBackground');
27e41f4b71Sopenharmony_ci    appRecovery.saveAppState(this.context)
28e41f4b71Sopenharmony_ci}
29e41f4b71Sopenharmony_ci```
30e41f4b71Sopenharmony_ci## Added the setRestartWant API to cl.ability.appRecovery.
31e41f4b71Sopenharmony_ci
32e41f4b71Sopenharmony_ciThe API **setRestartWant (want: Want): void;** is added.
33e41f4b71Sopenharmony_ci
34e41f4b71Sopenharmony_ci**Change Impact**
35e41f4b71Sopenharmony_ci
36e41f4b71Sopenharmony_ciTo develop an application based on OpenHarmony 4.0.5.2 or a later SDK version, you can use **setRestartWant** to set the ability to recover.
37e41f4b71Sopenharmony_ci
38e41f4b71Sopenharmony_ci**Key API/Component Changes**
39e41f4b71Sopenharmony_ci
40e41f4b71Sopenharmony_ciThe **setRestartWant** API is added to the **@ohos.app.ability.appRecovery.d.ts** file.
41e41f4b71Sopenharmony_ci
42e41f4b71Sopenharmony_ci| Module| Class| Method/Attribute/Enum/Constant| Change Type|
43e41f4b71Sopenharmony_ci|  -- | -- | -- | -- |
44e41f4b71Sopenharmony_ci| @ohos.app.ability.appRecovery.d.ts | appRecovery | setRestartWant(want: Want): void; | Added|
45e41f4b71Sopenharmony_ci
46e41f4b71Sopenharmony_ci**Adaptation Guide**
47e41f4b71Sopenharmony_ci
48e41f4b71Sopenharmony_ciCall **setRestartWant** to set the ability to recover.
49e41f4b71Sopenharmony_ci
50e41f4b71Sopenharmony_ci```ts
51e41f4b71Sopenharmony_ciimport appRecovery from '@ohos.app.ability.appRecovery';
52e41f4b71Sopenharmony_ciButton ("Start to Recover Ability")
53e41f4b71Sopenharmony_ci    .fontSize(40)
54e41f4b71Sopenharmony_ci    .fontWeight(FontWeight.Bold)
55e41f4b71Sopenharmony_ci    .onClick(()=> {
56e41f4b71Sopenharmony_ci        // set restart want
57e41f4b71Sopenharmony_ci        let want = {
58e41f4b71Sopenharmony_ci            bundleName: "ohos.samples.recovery",
59e41f4b71Sopenharmony_ci            abilityName: "RecoveryAbility"
60e41f4b71Sopenharmony_ci        };
61e41f4b71Sopenharmony_ci
62e41f4b71Sopenharmony_ci        appRecovery.setRestartWant(want);
63e41f4b71Sopenharmony_ci    })
64e41f4b71Sopenharmony_ci```
65