drkr
drkr

Reputation: 436

Android - What folder can I use to save the apps data against wipe?

I am building the Android 9 Pie GSI from the AOSP and flashing it into the PIXEL 3XL. I have my own application and I have added it to the Android 9 Pie GSI ROM - so this application builds together with the ROM. This application has privileged app permissions (located in /system/priv-app) and its data must be protected from the userdata wiping.

I tried to use the /persist for this purpose, but it's read only. I tried the /mnt/vendor/persist/ and I got the "permission denied" error.

What folder can I use to save the apps data?

Upvotes: 0

Views: 835

Answers (1)

Otieno Rowland
Otieno Rowland

Reputation: 2250

The answer here at: https://android.stackexchange.com/a/47951/56147 will help. Please take a look at it. In summary the link says that:

"All apps (root or not) have a default data directory, which is /data/data/<package_name>. By default, the apps databases, settings, and all other data go here. If an app expects huge amounts of data to be stored, or for other reasons wants to "be nice to internal storage", there's a corresponding directory on the SDCard (Android/data/<package_name>)."

which I believe is mostly correct and should help set you on the right path. As you have root access, you can write anywhere, including where the user has no access.

Upvotes: 0

Related Questions