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

My project is called test too. :grin: Not able to upload assets.

Thanks for the pointers. I have a theory about why this might be happening.

If the new File component is released without a tutorial with examples I expect it will be a disaster. Experts(?) are confused; what will the novices do? We should start thinking how we can present some Block examples doing this for various versions of Android.

Can the next version 187 be released without this needed File update? I am attempting to compile a collections of simple actions that fail but currently have issues retrieving any File.

What kind of specific examples can we provide for you @ewpatton to help you sort this out realizing this is an Alpha version of File and lots of stuff seems broken?

Cannot load extensions into the Project, probably because these load into assets. Attempted to use Taifun's TaifunFile

Do we need an API checker block in the File component, in order to know whether to ask for READ/WRITE permission or not, and to set the file paths accordingly for devices less than Android 10 ?

If on Android 11, will WRITE permission (and therefore READ) be granted automatically to all the scopes?

Is it possible to make the file paths (hidden in the component blocks) more transparent, in order that we have some idea of where a file will be stored ? You can save a file, and have absolutely no idea where it was saved to...

Yes. In order to use the File and create an app that will work with various Android versions, this is essential (or developers are going to have a convoluted experience using someone's extension to determine which directory is appropriate and even then he/she will have to provide the Blocks to figure out where the pieces go.

It is currently not possible to request READ or WRITE permissions, because the File component (incorrectly) no longer declares these permissions in Manifest.

But it should do it like this:

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

I checked it on Android 9 after declaring the permissions in the Manifest.

Even if I check the boxes in the Designer ? - are you saying this functionality is currently broken in the test server?

I suppose the question I should have asked is: "When/under what circumstances would I use the permissions checkboxes in the designer?"

Ah, I didn't notice this.
If both are checked:

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

maxSdkVersion=18 :question: @ewpatton

READ permissions works on all Android versions (also on Android 10+ and with targetSdkVersion=30).

Ok, this is only necessary in order to receive the permissions for the ASD on devices with API < 19 (before KitKat), because READ / WRITE are no longer required for the ASD from API 19 onwards.

But this means that both permissions can no longer be granted on devices with API ≥ 19.
And it shouldn't be like that.

https://developer.android.com/guide/topics/manifest/uses-permission-element

1 Like

The DefaultFileScope on Screen1 controls where files are written by default. In this upcoming release, this will be App by default, which means that all unqualified file accesses should end up in the app specific directory. If you want to be able to access files outside of the ASD, you'll need to switch the DefaultFileScope to Legacy, which will drop the max sdk constraint on those permission.

I get the same in the Manifest if I set:

grafik :

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

I think there is still a lot to be done to get this all properly in the short time left (only 2 weeks). And I have the advantage over most users that I'm pretty familiar with the Android storage architecture (at least that's what I thought until now :wink: ).

From Aug 2021 we will get a lot of work with user questions. I'm sure.
I think I'll have to take a longer vacation from then on. :grinning:

It's probably this setting:

grafik

1 Like

Maybe the block accepts a list.

I've fixed a number of the issues reported in this thread. You'll need to update the companion to 2.60file2u using the corresponding QR code from the help menu. The build server has also been updated.

Regards,
Evan

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

3 posts were split to a new topic: How to copy non media files from the Download folder to the app folder?