[FREE] ASD Downloader Extension - Download and manage files in ASD

Short description

ASD Downloader extension to download files in App Specific Directory (ASD) without READ or WRITE PERMISSION. Since ASD is always accessible to READ and WRITE files within the app it does not requires READ and WRITE PERMISSION.

Nowadays due to new restrictions in higher Android versions it is difficult to manage files without READ and WRITE PERMISSIONS where ASD is very useful to store downloaded files and manage them without any permission.

This extension allows you downloading files in ASD and managing them with various functions.

You can either show download system notification or you can hide it using this extension, also you can create a custom notification layout if you want.

There is already extension available to download files to ASD, I have developed this extension with some additional functionalities which makes this extension more useful and gives more scopes to manage files in ASD.

Both extensions are useful, you can use any one as per your requirement.

Picture of all the blocks

image
image
image
image

Instructions to use your extension

image
Returns ASD path of your app. ASD will be by default created when app in installed, this block checks for ASD if not exist then it creates and returns ASD path.

image
Download files from given URL, set file name with file extension. Default file download location will be ASD, if you want to download in a specific folder then specify folder name before file name and make sure that folder is already exist in ASD if not you can create folder by using CreateFolder block. One file can be downloaded at a time.

image
Returns real-time total size of the file, downloaded size, progress in percent of ongoing download task.

image
Returns downloaded file path.

image
Raises when any error occurres.

image
Cancel ongoing download task.

image
Raised when download is cancelled and returns the file url which has been cancelled

image
Returns true if download task is in progress else false.


Returns true if file exist from given file path.

image
Deletes the given file and returns deleted file path.

image
Creates a new folder in ASD with given folder name and returns created folder path.


Renames the given file path with new file name and returns file path of renamed file.


Copy file asynchronously from source path to destination path. You can copy file from one folder to another but make sure that destination folder already exist in ASD if not you can create by using CreateFolder block.

image
Returns the file list and folder list from given path.

Change Log:

Version 2: Added additional blocks.

Version 3: Added Show Notification and Notify Completed properties.

image

Download

Latest AIX: Version 6: (Compatible with API 34): ASDDownloaderAPI34.aix (35.2 KB)

Please test this and let me know if any issue or need any additional functionalities, I will be happy to add them if possible.

Leave a like if found useful :heart:

11 Likes

I've done a few quick tests and everything seems to be working fine. There are some features that my DownloadToASD extension does not provide. However, some methods require storage permissions that are not declared in the Manifest by the extension:

  • READ_EXTERNAL_STORAGE is required on all Android versions (at least before Android 13 must be targeted on August 31, 2023).

  • WRITE_EXTERNAL_STORAGE is required on all Android version less than 11.

2 Likes

Thank you for your tests.

But READ, WRITE PERMISSION is not required to manage files in ASD.

Once again:

Just a few examples:

  • .GetFileList (READ perm. on all Android versions, for listing media files)
  • .CopyFile... (to non-ASD-dir methods - WRITE perm. on Android < 11)
  • .DeleteFile (WRITE perm. on Android < 11)

I also read that there will be new read permissions for different files. Music, Pictures, etc...

1 Like

Yes... as already mentioned here:

Starting with Android 13, READ_EXTERNAL_STORAGE is replaced by 3 other (new) permissions, separately for images, audio and video:

  • READ_MEDIA_IMAGES
  • READ_MEDIA_AUDIO
  • READ_MEDIA_VIDEO

After Aug 31, 2023 (targetSdkVersion = 33) READ permission should be declared like this:

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"
                 android:maxSdkVersion="32" />

I will also include this and other changes starting with targetSdk=33 in my guide "Some basics on Android storage".

Is it specifically for non ASD path or for ASD as well?

:ballot_box_with_check:

1 Like

Okay, so as my extension is specially for ASD then no need to declare permission in extension to manage files in ASD

Also,

I have tried to copy a file from ASD to storage/emulated/0/Download folder and it worked without READ WRITE PERMISSION.

Yes, on Android 11+, but on Android ≀ 10 storage permissions are required.
And as I said READ perm. is also required on Android 11+ for listing media files, that are not created by the app itself.

Read this guide:

This statement is also wrong, because the minSdkVersion is 7 with AI2 (Android 2.1, Eclair). On API < 19 (Android 4.4, KitKat) storage permissions are also required for the ASD.

Believe me, I've had quite a bit of experience with these "beloved" permissions for more than 10 years. :wink:

2 Likes

Thanks for your information.

Anyways most of the components requires min. Android level 5, so I believe most of the users won't face any issues using the extension to work with ASD.

No.

Then you shouldn't have provided these methods:

Not for non ASD actions, I am saying for ASD.

As I said, you must declare READ & WRITE permission in the Manifest (at least for API 7 - 18) also for ASD. So users must add a File component and enable the READ + WRITE permissions in the Designer.

2 Likes

Version 2 Updated

WHAT'S NEW

  1. Fixed file not downloading issue with some links.
  2. Renamed StopDownload to CancelDownload.
  3. Removed GetDownloadSpeed block due to internal issue.
  4. Added new method FileSize to get file size from file path.

image

1 Like

Hello, I am testing your extension and I have a problem that seems to be url dependent. I tested using your test app and also with simper example written by myself and the results are the same.

  1. Example that works: url = https://levocidiastarte.com filename: win.ico
  2. example that does not work: url = https:/levocidiastarte.com/tmp filename: win.ico
    this example does not work returning this error: Failed to download the file. Reason: placeholder

I uploaded the same files in both directories in the server, you may test with a normal browser, I did not put any read restrictions on those directories.
Do you know what means the error? And do you may explain me the different behaviour?
Thanks,
Massimo

Ok, I found the solution but in my opinion there is a problem. If my file is https://levocidiastarte.com/tmp/win.ico I have to input to ASD.DownloadFile url as https://levocidiastarte.com and as fileName tmp/win.ico and then it works. The problem is that DownloadFile saves the file in ASD/tmp (for ASD I mean the folder of the app ASD. I think that givin one more input (may be path?) could be better because the user can select the directory where download the file.

Hi,

As this extension is to download files in ASD, download file path is by default set to ASD. You can change the download location within the ASD in other folders but not outside the ASD.

If you want to save that file in other locations either you can copy the file from ASD to your preferred location after it is downloaded or use other download extension/component that allows you to set download path.