Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The best place to store a user-accessible configuration file

I have a project consisting of four programs for different platforms; all of them use the same XML-based settings file format. I want to be able to manually modify/overwrite it outside of the application. On Windows, Windows Mobile and Linux I'm using "user.home", but on Android that alias isn't implemented. I'm thinking about simply putting it in the Downloads directory, however, that doesn't feel right.

I can't be the only one, who needs that kind of functionality. Or this isn't Android-way? Any suggestions are appreciated.

EDIT: I'm OK with the settings file not being available all the time (i.e. SD-card removed), it's used only on the start-up of the application.

like image 810
Alec Mev Avatar asked Dec 04 '25 17:12

Alec Mev


1 Answers

Store it in getExternalFilesDir(). This would work only if the device has an external storage. The user would be able to access it.

However, take note of the following from the docs:

External files are not always available: they will disappear if the user mounts the external storage on a computer or removes it. See the APIs on Environment for information in the storage state.

like image 96
Dheeraj Vepakomma Avatar answered Dec 06 '25 06:12

Dheeraj Vepakomma