How to list (specific) files from the assets on Android ≥ 10 (API ≥ 29) → Companion

This way you can list (specific) files from assets using Companion, if your device is running Android 10 or higher:

App Inventor Extensions: File | Pura Vida Apps
App Inventor Extensions: Tools | Pura Vida Apps

1 Like

Good stuff

What changes in a compiled app ?

Everything stays as it was before.
Assets are stored in Internal Storage:

/data/data/<packageName>/

The blocks remain exactly as they are then it is just the packagename that changes due to not being the companion app.

/data/data/ ?

1 Like

While we put the assets in the external storage partition for debugging purposes, people really shouldn't rely on that for two reasons:

  1. In compiled apps, the assets are part of the app and don't live on external storage.
  2. We reserve the right to place assets in the companion wherever we feel is appropriate and it may change again in the future, like it did in nb184.

Exactly what I said.

Then we have to adjust something in the blocks for debugging. So what's the problem?
Because this (problem) already exists now.

I should also point out that the assets folder for the companion will contain the union of all assets for projects you've loaded, it's not just the assets specific to the current project. There's no guarantee in your blocks image that listAssetsJPG will be the same in the companion and the compiled app because of this.

Of course, but I wanted to keep this little guide short. It is no problem to filter the jpg files from the listAssetsJPG.

it looks like I should make a short adjustment in the FileListFromAssets method for API >= 29...
Taifun

2 Likes

I forgot to mention this earlier, but Version 13 of the file extension now correctly lists the files from the assets also for devices running Android 10 or newer

Taifun

1 Like