HOWTO: Get Application Specific Directory -ASD (where one exists) without Extensions

Ditto.... :slight_smile:

Here is a simple way to do it for all Android versions and without any component and permission:

getASD.aia (2.9 KB)

1 Like

Yes, that was my first approach, but it requires you to open up an aia and look at project.properties, or look at your project details in the program, in order to enter the required information, which is then hardcoded. My approach is about being more dynamic.

Not sure what your issue is about components or permissions....?

Yes, check my aia.

1 Like

I think if you are working on a project you probably know the name of your project as well as your email address. So what's the problem?

I always try to use as few components as possible. And it is even more important for me (and especially my users) to avoid dangerous permissions. My users (like myself) don't like permissions at all.

(thread added to FAQ)

You missed out the hardcoded part....

How will you read or write anything from the ASD if you don't have those permissions in place ?

No, this is no problem in this case.

As I said several times, the ASD does NOT require any permissions according to Google (≥ API 19).

It is easy enough to drop the File component, it was only there to remove an empty file, not taking up any space

The extensions-free solution is great for people looking to publish apps to the gallery. As we know, extensions are prohibited there.

Yes, but as I said the approach from @TIMAI2 doesn't work for API<29.

the solutions, which are provided by extensions (be it @Anke's extension or one of the file extensions) do not need any permissions to read or write files from/to the ASD - Application Specific Directory

to have a "solution" which needs permission to only get the path to the ASD seems not very helpful...
and we are not only talking about the File.Delete method, but also the Canvas.SaveAs method...

exactly... the subject of the discussion is "Get ASD without Extensions" and as @Anke already explained, you do not get the ASD for devices < Android 10, you get the root directory...

usually users try to write an app with as less permissions required as necessary

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

3 Likes

But if you are creating an application for school or to be placed in a gallery, nobody cares about the lack of permissions, the application is only supposed to work. If someone is creating an application for Google Play, it is of course recommended to have as few permissions as possible.

Yes, maybe. But again: the main problem here is, as I already said, that it doesn't work for devices with Android < 10.

@TIMAI2 might want to edit the subject of this thread and add "only for devices >= Android 10"
Taifun

1 Like

I linked to this thread from the Files FAQ because of the rich vein of opinions in it. The different considerations are valuable.

3 Likes

I did not understand Replace block, can you explain me ?

It removes the filename, to return the ASD or ROOT DIRECTORY only

my result is a file path, not a folder
/storage/emulated/0/Android/data/edu.mit.appinventor.aicompanion3/files.png

Did you set the local variable "file" to "files.png" ?

image

replacing "dummy.jpg"