Get the path of → ASD (app-specific dir) & → private data dir (internal storage)

Here is a small extension to get the ASD (path of app specific directory) which is becoming more and more important on Android 10+ and the private data dir (→ internal storage):

Updated: 26 Feb 2022:
GetASD_API.aix (5.3 KB)

grafik

The reason why I now added the privateDir will soon become clear when I show you how to store any kind of files in → internal storage (and not just text files like the File component does).

I think this is a milestone (at least for me):
I am very happy that this is (now) possible, because I can bypass the problems that will arise when Google only allows AABs (and no longer allows APKs, Aug. 2021 for new apps). Because I have to pack all my media files and other sensitive data in the internal storage to avoid that users (without root access) can access them (and decompiling in order to build a big app does not seem to be possible with AABs).

And I know from many posts in the AI2 and Kodular forums that many others feel the same way. E.g. → @HeyAveHey

24 Likes

Here are my tests copying images to the private data dir (→ internal storage), tested on:

  • Android 11, APK, targetSdkVersion=29
  • Android 11, APK, targetSdkVersion=30

I first downloaded 7 images from my webspace in the ASD and copied them from there to the privateDir without permissions. I also copied one image from the assets to the privateDir:
This one:
grafik

The other (downloaded) images are pics of a car.
(total size of images = 4MB, but 30MB works too)

Of course, I could not use the Image component without READ permission. So I used an extension for this. But I’m pretty sure that the permission request will be removed when Kodular targets Android 11, Aug. 2021).

The maximum AIA size of 30 MB is not enough for my apps. So I have to download the files on the first run, download them to the ASD, copy them to the privateDir and then remove them from the ASD.

6 Likes

then why not download to private dir directly?

1 Like

Because it is obviously not possible to download files to the privateDir (internal storgage) using the DownloadManager.

1 Like

we can download file to private dir with Web component, no need read or write permission.

1 Like

I don’t think so, but I like to be surprised and am curious about your approach (blocks).

Sorry my mistake.
It indeed need the write permission even if download to private dir.

I made this mistake, because I tested on other AI distro (wxbit), where the write permission not needed.

Yes, but furthermore it doesn’t seem to be possible (even with WRITE permission) to download files to the privateDir using the Web component.

So again, show your blocks.


What does this path have to do with the privateDir (internal storage)?

Nothing!

As I said before, it doesn’t work with the Web component.

1 Like

I tested on Wxbit (app.wxbit.com), Web component can download to private dir, and with no write permission.
Maybe they modify the source code.

Kodular staff should do the same, i think.

We are here on the Kodular community. So please test with Kodular.

When I test something, I basically do it on the original (→ AI2) and on Kodular.
On both of them it doesn’t work with the Web component (and I doubt it works with other distros, regardless of the permissions issue).

Permission will be always asked:

1 Like

And for this path → grafik
WRITE permission is required in any case.

Even with the ExtendedDownloader extension from @Atom_Developer it does not seem to be possible to download directly to the privateDir.

Thanks for this extension.

How to delete the files on ASD directory?

How Can I share a file after any given file has been downloaded?

Thanks for your support!

These questions don’t actually relate to my extension, but nevertheless:

2 Likes

Thanks for your time and orientation on this.

Regards,

MS

Where is “Path” component in this extension ?