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