Works in Companion and for compiled apps, tested on Android 10
(should work across all android versions....returning the root of the sdcard in pre 10)
The ASD did not exist before Android 10.
No, this works only for devices with Android ā„ 10.
In addition, two additional components are unnecessarily required and moreover WRITE_EXTERNAL_STORAGE is requested. In my opinion, the biggest disadvantage is that a dangerous permission is unnecessarily required for this.
Sorry, but that's not really an alternative to my little extension ā GetASD.
Ah, @Anke, your usual negative and unhelpful response of "No" !
It does "work" across pre 10 (I tested on Android 7). But because there is no ASD as such, it returns the root of the sdcard. So it "works"....
Yes, the canvas and file components are used, but this is required in order to negate the need for an extension and return the directory location, the whole point of the blocks. Many developers may already be using a canvas or file component in their projects, they can therefore make use of this without adding extras.
By using the File component, this introduces the WRITE_EXTERNAL_STORAGE permission. I really do not see what the issue is here, a user will probably want to be reading and writing to the ASD / root of the sdcard if they need to know where it is in the first place ?
It is an alternative to "your little extension", which indeed works very well, and to other extensions that offer the same functionality.
I welcome your constructive comments, but please seek to be a bit more positive in your responses. Like you, I am hopeful that soon we will have a built-in method for this, which will therefore make any such methods and extensions redundant!
Regardless of the need to use the ASD from API 30 onwards, the main advantage of the ASD is that no READ_ / WRITE permissions are required. In this respect, as I said, it is a major disadvantage if these permissions are requested.
It is clear to me that for API < 29 with your method the root dir of the external storage is returned, but that is precisely the problem. Therefore, this method does not work for all Android versions. I would also like to know what is so problematic about the word "No", if it applies.
Btw, as you should know, I am very positive towards everyone - and especially you: Appreciation for @TIMAI2
But if something is not helpful or wrong, then I reserve the right to state it clearly, without further ado.
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....?
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.
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
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.