File component - save (all types of) files in the Private dir (→ internal storage)

Companion cannot be used for testing under Android 4.4 (API 19) upwards, as READ / WRITE permissions cannot be requested / granted.

Companion declares these permissions in the Manifest:

 <uses-permission android: maxSdkVersion = "18" android: name = "android.permission.WRITE_EXTERNAL_STORAGE" />
 <uses-permission android: maxSdkVersion = "18" android: name = "android.permission.READ_EXTERNAL_STORAGE" />

I have done numerous tests with the APK. Some things work now, but I was unable

  • to list the assets or
  • copy a file from the assets or another directory (including the ASD)
    (Note: the app crashes, also with companion).

However, saving a text file in /Documents or the ASD works.

I think I tried all possible ways to list the assets and copy a file.
So please show (example) blocks how the following is possible:

  1. List the assets.
  2. Copy a file from the assets (e.g. to the ASD).
  3. Copy a file from the external storage (e.g. /Documents/abc.txt, that I saved there in one of my tests) to the ASD.
1 Like