目录

How do I configure not to retain mission snapshots in Recents after terminateSelf() is called for a UIAbility?

In HarmonyOS application development, terminateSelf() of the UIAbilityContext class is used to terminate the current UIAbility instance.

If you do not want to retain mission snapshots in Recents after terminateSelf() is called, set removeMissionAfterTerminate to true in the module.json5 file.

{
  "module": {
    // ...
    "abilities": [
      {
        // ...
        "removeMissionAfterTerminate": true,
      }
    ],
    // ...
  }
}
  • The default value of removeMissionAfterTerminate is false, indicating that mission snapshots are retained in Recents by default.
  • When removeMissionAfterTerminate is set to true, the mission snapshots are retained in Recents after terminateSelf() is called.