[DISCONTINUED] Extension to download a file to ASD (app-specific directory) without WRITE permission

In Android 9, I can download the file to the ASD (Screen1.DefaultFileScope: Cache, Legacy, Private...). I think it will also be possible on Android 11.

borrar_bajar_arch.aia (2.0 KB)

borrar_imagen

1 Like

Dankeee Anke! :wink:

2 Likes

Yes, but you need WRITE permission for that (which of course shouldn't be the case).
If you deny storage permission you get
Error 908: ... WRITE has been denied ...

On Android 11 WRITE must be declared in the Manifest (which doesn't make any sense at all).
I've already reported these bugs ...

1 Like

Working fine in Android 10 and Android 11.
Thanks!
Is good idea event DownloadCompleted return fileName like Web.GotFile.
In this case I can do this:

1 Like

Here is an example to download multiple files to the ASD and replace the files that have already been download before:

downloadToAsd.aia (10.0 KB)

1 Like

UPDATE (version 3): Download with progress feature

A progress feature has been added. The progress can now be displayed in bytes / MB and as a percentage during the download. Thanks to @Kumaraswamy who is "light years" ahead of me with Java. :wink:
de.bodymindpower.downloadToAsd.aix (15.2 KB)
(created using Rush - thank you again for this great tool @shreyash)

Note: The DownloadProgress event doesn't seem to complete, but it does (it just doesn't show up in time). Therefore, you should also use the DownloadCompleted event so that 100% is displayed at the end.
→ See my example blocks below.

Example blocks:

4 Likes

I added two new blocks now, so you can check if the file is already downloaded (exists) and you can delete the downloaded file again.

1 Like

I had to fix a bug affecting the .Exists and .Delete methods on Android 10+.

1 Like

Dear Anke, could you make the version 4 without notifications?

1 Like

@Anke let me suggest to add a boolean property ShowNotifications, default value true, which can be configured to also not show the notifications (in case its value is set to false)

Taifun

2 Likes

Hi Anke,

Your extension with disabled notification unofortunatelly didn't work for me. Anyway I added:

<uses-permission android:name="android.permission.DOWNLOAD_WITHOUT_NOTIFICATION" />

in the manifest file of my apk, installed apk but the notification still appears. What is more interesting I have apk file of other application which was made in MIT app inventor and which does not have this specific permission in manifest but despite this fact it is not showing download notification. So there has to be different way of getting rid of this notification. Any ideas? :slight_smile:

Seems, it would work if Anke will compile extension with UsesPermission annotation.

This is really needed....

1 Like

I also updated the first post of this topic.

3 Likes

Hello, why does this message always pop up when I use your aix extension? even Version 4 (April 19, 2022):
de.bodymindpower.downloadToAsd.aix (16.7 KB) as well.

Edit Post: I tried clearing the cache of the companion and everything is fine. sorry for the inconvenience and thank you for the aix you did. I hope you can do more aix.

2 Likes

While starting the companion app, all necessary assets and also the imported extensions of your project will be copied to your device. So in case the no such class error shows up, the extension code to run the extension is not available on your device. Without that code the companion app is not able to execute methods from the extension

Just restart the companion app and try again

Taifun

1 Like

Oh.... :open_mouth: okay that why i encountered this error. Next time it is better to restart the companion instead of clearing cached. Noted on this @Taifun Thank you so much for further explanation.

  1. You do not use version 4:

  2. AI2 nb109a → nb190a

  3. Your URL does not point to the txt file:

  4. The APK is build for me with no issues (for the first time :woman_shrugging:).

  5. Try this one: downloadToAsd_test2.aia (19.4 KB) - Companion & APK on Android 12:


Hi Anke - very strange

  1. I installed v4 over v2 and the above version was displayed - now the Browser has been rebooted it is not displayed. By the way - what does the Z mean?

  2. [quote="Anke, post:76, topic:19367"]
    Your URL does not point to the txt file:
    [/quote]

It's the path, the filename is separate (in the actual App it could be one of many)

Companion - displays a blank screen.

Installing APK:

Security threat
downloadToAsd_test appears to be malware and poses a high risk (View details). Immediate uninstallation is advised.

Details
downloadToAsd_test
This app is infected

THREATS
Virus name Evo-gen
Danger level High :roll_eyes: