简体   繁体   中英

Best way to share preferences between user profiles on Android

I'm trying to port our app to run on a vendor's tablet, which uses Android's multiple user profiles . This creates a problem, because each time a profile is created, our app goes into setup mode (because the SharedPreferences aren't setup yet). I'd like to have the administrator profile set up the app once, and all other profiles will just load this configuration.

SharedPreferences doesn't seem to work, so what's the best way of doing this?

You can save your preferences to a file. I would make an object, then convert it to json, and finaly save the json to a file. When loading the app I would take the file and read the json back to an object. BTW: shared preferences is a xml file located on your device.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM