Intelligent Assistant
Chat with our virtual assistant to get answers promptly.
When a device is upgraded from HarmonyOS 3.1 Release API 9 or earlier (HarmonyOS for short) to HarmonyOS NEXT Developer Preview1 or later (HarmonyOS NEXT for short), the APK applications running on HarmonyOS must be switched to the HarmonyOS applications in HarmonyOS NEXT after a system upgrade. Some data of the APK applications can be accessed by the HarmonyOS applications only after it is converted and migrated to the specified storage path. HarmonyOS NEXT provides a data migration framework and a backup and restore framework to enable developers to migrate and convert application data. After the APK is switched to a HarmonyOS app, the data that is compatible with the HarmonyOS app in the original APK can be inherited.
As shown in the following figure, the data required by the application includes the data in the cloud server, data in the local application sandbox, and data in the local public media library. To ensure that the application data can be inherited, the cloud data definition must be compatible with APK applications and HarmonyOS applications so that data of the same account can be identified after the system upgrade.

After a device is upgraded from HarmonyOS to HarmonyOS NEXT, the APK application sandbox data is migrated to the intermediate directory. For application sandbox data, HarmonyOS NEXT provides a data migration framework to schedule application data migration tasks in a unified manner.
An application data migration task involves application installation, data migration, and data restoration.
Application installation:
Data migration:
After the HarmonyOS application is installed, the data migration framework migrates the application sandbox data from the intermediate directory to the backup and restore directory.
Data restoration:
After that, the HarmonyOS application accesses the HarmonyOS application sandbox to obtain application data.

Data in the public media library will be migrated and inherited after devices are upgraded from HarmonyOS to HarmonyOS NEXT. Applications can access data in the public media library using the APIs provided by HarmonyOS NEXT. For details about how to use the media library, see Media Library Kit Overview.
