When the app process ends, you can call liveViewManager.stopLiveView in the onDestroy() method of the UIAbility lifecycle and set the keepTime value of the PrimaryData instance to 0 to close the live view immediately.
If the onDestroy() method of the app cannot be called due to an abnormal termination of the app process, the live view will not disappear.
Starting from version 26.0.0, live views support automatic closing through a specified lifecycle mode during creation. When calling liveViewManager.startLiveView, set the lifeCycleMode value of the LiveView instance to AUTO_STOP_WHEN_APP_TERMINATE to automatically close the live view when the app process ends.
Starting from version 6.1.1(24), you can control the maximum lifetime of a live view when the app cannot actively stop it. During creation, set the aliveTime attribute of the PrimaryData instance to enable automatic closing of the live view.
When a live view is updated locally, you can call the liveViewManager.getActiveLiveView function to obtain the active LiveView instance.
To end a live view, you are advised to use the liveViewManager.stopLiveView method. If the live view is cleared through notificationManager.cancel or notificationManager.cancelAll, neither Live View Kit nor Push Kit can update or end the live view again using the same ID.
When creating a live view again with the same ID, Live View Kit can create a new live view with that ID, while Push Kit cannot create a live view with that ID again within 12 hours.