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

It turns out it's the Taifun Package Manager extension. They don't build together.

Anyway, I now use PkgUtils instead of TaifunPM, as it can do the same and much more.

Thank you @Anke and @everyone

1 Like

Works great in built apk, but in the companion it gives execution error:
Screenshot 2021-08-27 at 06-01-41 MIT App Inventor
Perhaps you could bypass it if we are in companion environment? If it's easy, which I think might be. Thank you :slight_smile:

I believe the error occurs because the DOWNLOAD_WITHOUT_NOTIFICATION permission doesn't exist in the companion app.

Yes, exactly.

Hi again,

I noticed that the file downloading doesn't stop, even if we close the app (and from android settings > force close). This, while it's great, sometimes is unwanted. Can anything be done about it?

If the file is big enough, it can eat up the user's mobile data credit.

I think of two possible ways (though I have no idea how things work):

  • provide a stopDownload block
  • when the download is requested, don't detach it from the app, or attach it to the app

Thanks :slight_smile:
Fotios Tisfo TSF Anonwins

edit: I managed to cancel the download (by sending a request to the server :rofl:) but I see there is an automatic retry after ~40 seconds.. Perhaps we would be able to modify this instead? Thanks again

Hi Anke,

great extension. Works very well with one exception...
On the first screen of my app I've added the extension 2 times:

  • during screen innitialize I've added it as "dl_pliki_csv" to download some CSV file updates
  • after button click I've added it as "dl_app" to download the updated APK file

There is a .DownloadCompleted event for "dl_app", but it is triggered on screen innitialize (as it would be an event for "dl_pliki_csv". I'm uploading the relevant blocks.

PS: as a functionality, you could add a true/false file overwrite function.

With only one extension dragged into the designer:

grafik

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