With this extension you can download an APK to the ASD (app-specific directory) and install it. This doesn’t require WRITE / READ_EXTERNAL_STORAGE permissions.
However, you can also install an APK from another directory (e.g. the /Download folder) (with READ permissions).
This should work on all Android versions, especially on Android 9, 10, 11.
Update v3 (Oct 25, 2020):
aix removed
Blocks version 3
Update v4 (Nov 2, 2020):
→ DownloadCompleted event added
→ Create Download directory in ASD
→ Create subfolders in Download dir of ASD
With version 5 there seems to be a compiling issue with some special extensions. This has been fixed in version 6. In addition, two new blocks have been added to check if the APK has already been downloaded (exists) and to delete the APK again after downloading. (This version was now created using Rush.)
I simplified my example blocks a bit (without using TaifunFile ext):
download the APK from Google Drive to the /Download (default) folder and copy it to ASD
install AKP from ASD
Of course you need the WRITE permission for this, since the download component always downloads to the standard folder (/storage/emulated/0/Download).
To avoid this, you need to use an extension that also allows you to download a file to a specific folder. I only know that the Download extension from our beloved can do that. Maybe someone has a better suggestion.
Seems like Kodular uses preset dir.
Download Manager’s documentation says that file will be saved in dir specified using setDestinationInExternalPublicDir method so you can save file in external storage in any dir.
Staff can clarify our doubts.
thank you for your contribution…
does the extension also work in the companion app as well as in App Inventor?
and if you like to follow the naming conventions, then please start the extension name with a capital letter… InstallApk or InstallAPK would be the correct name according to the conventions…
It does not work with the Web component because the APK file is corrupted with your procedure after downloading.
I found a way to do it with the Web component only. But in this case you must ask for WRITE permission, because the Web component enforces that, even when downloading to an ASD (shouldn’t be like this!).
See here (works with Companion, of course without asking for WRITE perm.): installAPK2.aia (41.4 KB)
That depends on how you use the extension. If you use the Download component, the permission will be requested automatically. If you put the APK in the assets (and copy it to ASD), no permission is required at all.
Here is an new version of the extension.
I added a Download method (thanks to @vknow360 for support!) with that you can download an APK (or whatever file you like) to the App-Specific Directory (ASD) and install it (without WRITE / READ permissions): de.bodymindpower.InstallAPK.aix (9.0 KB)
I also followed the naming conventions, which @Taifun pointed out.