I’m developing an app that can be set as the default launcher in Android. Users were reporting that most of the times (but not always?), after rebooting their phone and the app was launched automatically by the system, they were losing their data and the app was behaving like it was the first launch. However, after restarting the app, their data was back, and everything was working fine.
After some investigation, we discovered that the Application.persistentDataPath
was different if the app was opening as the launcher app automatically after the reboot.
This corresponds to the getFilesDir()
path of the app. However, according to the Unity docs, Application.persistentDataPath
should correspond to getExternalFilesDir()
. Which is, indeed, the path that my app uses if it’s launched regularly (not by the system during reboot):
Does anyone know why this mismatch occurs? Is this an issue within Unity or on my side? Thanks!