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

Yes I get that error sometime ,but after reloading that is gone.

Sorry, I misunderstood.

Android 11, pixel 4a

I have issues with Android 4.2, 5.1 and 8.1 with the required Companion. It will not load.

This QR links to ai2.appinventor.mit.edu/b/64u7 fails to load either using Companion or Companion with the message : Error: Invalid Link

Is the 'new' testing companion compatible with Android 8.1 and lower?
How large is the test companion apk?

  • Steve

edit 30 minutes later: after multiple tries was able to download 2.60file1 on Android 5.1 and 8.1

Can you let me know the project name in your account? I can run some tests with a local build server to understand why the assets aren't being included.

My experience:
Device: Google Pixel 4A Android 11
Using Companion App 2.60file1
I checked both READ and WRITE permissions in the Designer

  • Copy to worked from assets to Private using // in front of filename for assets and blank for destination
  • Copy to worked from assets to ASD using // in front of filename for assets and / for destination
  • Using App or Shared saved a copy to file to the same place - ASD
  • Read File from Assets works using //
  • Read file from ASD worked (/), read file from Private worked (blank)
  • IsDirectory returned false wherever I pointed it
  • ListDirectory returned [] wherever I pointed it
  • MakeFullPath returned correct full path when setting path (?) to files

I find all the different scopes (names) a bit confusing, but guess this is just about learning what they all actually mean and do.

Not recognizing Assets

... Project is called test . Seems same issue as Anke. This on Android 8.1

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: