Can't create folder in Android 10

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.

Apple policy is that apps cannot run code not approved by App Store review, so the companion app can't support extensions otherwise it wouldn't be approved (or we'd risk getting thrown out of the store). We may be able to support extensions in compiled apps, but it will probably end up requiring extension authors to write the extension both in Java and in Swift. We don't have a time frame for when that would be supported.

1 Like

It's a 77x mobile

I have already manually checked that the file is created. (I have been checking it with each test)

It creates it because when starting with a slash "/" in the "file" component it goes directly to the root directory (in this the mobile 77x to the address "/ storage / sdcard0 /" but if you want to read it with the Taifunfile component, points to the address "/ storage / emulated / 0" (which does not exist on this device).

that is what I already indicated in previous comments.

That's why I prefer to use the "/ sdcard" path because at least it works fine for me for all the tests I've done.

For me this issue has been solved, how far I think I can go with my means.

@Isaac_Perez There seems to be something broken with the symlinks of your device:

https://forum.xda-developers.com/android/help/sdcard-storage-sdcard0-symlinks-broken-t3450251

As I said:

/storage/emulated/0

should work on all Android versions.