Can't create folder in Android 10

I've tried testing it on my Android 10 device and it won't let me install the app.

On a mobile with Android 4.4 the file path directions fail. (In development mode it works for me with the path: file: ///sdcard/AppInventor/assets/deviceVersion.html), in normal mode, I have not been able to find the path of the html file.

I have seen an extension related to this in Taifun's extension directory.

Or if you know to write extensions:

public String ApiVersion(){
  return String.valueOf(Build.VERSION.SDK_INT);
}
2 Likes

I was afraid of that on Android 10. Before packaging the app, use the production path should work.

file:///android_asset/deviceVersion.html . This fails on Android 4.4? and 10? You may still able to get this to work in the compiled app by requesting READ_EXTERNAL_STORAGE Sorry Isaac. I do not have an Android 10 to test. The example builds fine on an Android 8.1; did you change development to false before you attempted to build?

There must be a way to get an Android 10 to read files in the Media.

Try this APK:

It should work on all Android versions.

Blocks

(added to FAQ)

Note that the version number of the current platform can be retrieved by using the PlatformVersion property of the Screen component. This will return the user-facing version number as a string, such as "10.0" or "8.1". This property is available on both Android and iOS.

Thank you very much everyone for your answers.

This is just what I was missing from Anke's comment.

I hope this allows me to fix these issues temporarily.

Could you clarify, which contains the block "replace all text call Taif ..."?

Thank you very much

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