Get read/write access to a file in an Android app-private location
We need to persist some configuration - for example, the read capability for any magic-folder the app has access to. A simple way to do this is to write the configuration to a file on the device's filesystem. The file should be in an app-private area since it will contain sensitive information. We should be able to read, write, and rewrite the file at the path.
One possibility for doing this is to use the Android API getFilesDir
(https://developer.android.com/reference/android/content/Context#getFilesDir()) and then construct a path beneath that directory. Another possibility is to get the file directly with openOutputFile
(https://developer.android.com/reference/android/content/Context#openFileOutput(java.lang.String,%20int)) and `openFileInput (https://developer.android.com/reference/android/content/Context#openFileInput(java.lang.String)).
The Haskell library android-activity
provides access to at least getFilesDir
, perhaps also some other APIs.