Can't create folder in Android 10

This is much simpler than using the extension Anke recommended... thanks @ewpatton!

The image is the 2.2 emulator. Tested also on 8.1 Android.

-- Steve

Ohh, I didn't notice that. Thanks.

Does it work on your device?

In Android 10 it works correctly.

But after doing several tests, I see that I can have problems with the previous versions of android 10 if I want to save the files in the root folder of the application.

I cannot save the files in the root directory with the extension "call AplicationSpecificDirectory" from Taifun on a device with Android 4.4.2

I was hoping that these blocks that I attach you save in the file at: /storage/sdcard0/Android/data/appinventor.ai.bulone6868.test/files/a.txt

Captura

But it saves it in:
/storage/sdcard0/storage/emulated/0/Android/data/appinventor.ai.bulone6868.test/files/a.txt

So I think the simplest thing in my case (for now) will be to save the files in the root folder for Devices smaller than Android 10 and in the application folder for those older than Android 10. (In both cases I have created another folder to have the files sorted)

This is how the blocks would be:

Captura3 prueba_version_2.aia (34.2 KB)

Can you think of any other solution?

Thank you very much

Android KitKat has an issue.It takes /storage/sdcard0 as root directory.
Your blocks are correct and will work fine.

... and also on devices with Android < 10.

I changed some blocks of your aia:

This should work on all Android versions.

See also here:

In my device with Android 4.4.2 with those blocks it does not work.

This is the error:

.

Check this APK (on your Android 4.4.2 device):

https://drive.google.com/file/d/1W6XmqAm7dZQGCOqnFw0ADPQFg1bSon8u/view?usp=sharing

and post a screenshot after clicking on "save file" button.

Blocks

Should look like this:

grafik

Here is the screenshot:

The file saves it correctly, but the path is not:

/ storage / emulated / 0 / my folder / a.txt

if not that is saved in:

/ storage / sdcard0 / my folder / a.txt

that's why substituting:

/ storage / emulated / 0

by :

/sdcard

I get it to work fine on all Android versions regardless of how the path starts

Ok, I see. So try this one:

and post the screenshot after pressing on save file.

Blocks

This path

/storage/emulated/0

should work on all Android versions.

I checked my app (prueba_version_2b.apk) on a Galaxy S3 (Android 4.3):
It works.

Yes, but this is the problem, see e.g. here:

So we have to list all Android versions beforehand in order to be able to query that.
https://source.android.com/setup/start/build-numbers

No, it's much more compiled. :wink:

For some purposes it could be done this way:

But only Android 4

  • Ice Cream Sandwich
  • Jelly Bean
  • KitKat and
  • Wear

has 19 versions.

Here is the screenshot:

You can use this procedure to compare the version numbers even if the number has major, minor, and patch numbers:

For example, it should work correctly if you test against "4.4.2" as a version even though it isn't a mathematical number.

2 Likes

Yes, but is this really simpler than using this small extension:

This would be the first device on that

/storage/emulated/0

does NOT work. So please let me know which device is it.

But as you can see (→ your screenshot) /my folder/a.txt is created:

So it seems that TaifunFile.Exists doesn't work correctly.
Check if the file a.txt exists on your device (manually).
If so, does share file work?

If you want it to work on iOS, you won't have a choice. Also, you can drag that picture into App Inventor to add it to your project, no extension required, keep it in the backpack, etc.

So it already seems to be certain that extensions will not be possible under iOS.
I already thought so.

I build my iOS apps with Xcode & Swift.