Install an APK after downloading to ASD - works on all Android versions

Show your blocks.
And try this test APK:

  • Does it work on your device?
  • Which device and Android version do you have?

I've found the reason why the installAPK method doesn't work on devices with Android > 7. This line is missing in the Manifest of the Companion APK:

android:name="com.google.appinventor.components.runtime.multidex.MultiDexApplication"

If I add this line in the Manifest, it works fine also on Android 8, 9, 10, 11.
Maybe you or @ewpatton can tell more about this.

1 Like

This shouldn't be needed on Android 5 and higher. Prior to Android 5, MultiDex was needed for larger apps that ended up with their classes.dex file split across multiple files. Starting with Android 5, Android converts the dex files to oat files to work with the new Android Runtime (ART) on install so multidex is no longer needed. If you increase the minSDK of the app to 21 you shouldn't need the multidex declaration.

When I create an APK with my extension, this line is created in the Mainifest:

<application android: debuggable = "false" android: icon = "@ mipmap / ic_launcher" android: label = "installAPK AI2" android: name = "com.google.appinventor.components.runtime.multidex.MultiDexApplication"

and everything works as it should (on all Android versions) ...

Dear Anke,

installAPK_AI2.apk runs normally (download + install) = SUCCESSFUL

image
Is the version of de.bodymindpower.InstallAPK.aix that I am using compatible (the version shown in the picture)?

BestRegards,
Boike_Rimba

Yes, but I still need to add a "Download.Completed" event, as @Taifun said:

You have to wait for the download to complete:

grafik

image

@Boike_Rimba As @Taifun said:

"the method DownloadFileToASD is an asynchronous method and usually there should be an event to indicate, that the download has been finished..."

So remove the close application block and wait until the download has been finished.
I try to add the Download.Completed even soon (when I have more time).

grafik

@Boike_Rimba I added the Download.Completed event (→ Version 3 of the extension).

Example blocks

1 Like

Dear Anke,

My installation process was successful.
Thank you for the instructions & the newest extension.

BestRegards,
Boike_Rimba.

1 Like

When it comes to downloading the APK from google drive, you can download and install applications using ActivityStarter and it does not require any permissions on Android 9.

Which permissions?

What are you talking about here and how does that relate to this extension?
What are you trying to explain to us?

I wonder what additional benefits this extension will give me if I want to install applications from google drive? How does this relate to the installation method using ActivityStarter? Maybe in android 11 it is no longer possible to install from ActivityStarter and I will have to use the extension? I don't know, that's why I have doubts.

Then show your blocks to download an APK and install it using ActivityStarter (or post a test aia).

And I've doubts that it still works for newer Android versions with ActivityStarter.
See also here: https://puravidaapps.com/install.php

I will prepare a test application and you can see it on a newer android. Unfortunately, I have nothing newer than android 9.

Install this application. After opening the application there is an "Install App" button. After clicking on it, the application will download itself :wink: .

And here is AIA:
install_me.aia (2.0 KB)

This method downloads the file using Web and installs using Activity.
The method that is in my application doesn't download the file, at least not through the download manager. Installs it directly from disk. No permissions are required for this.

I suspect that this method uses "google drive" applications and mechanisms built into them.

1 Like

Hello.
First of all, thank you very much for your work, and forgive me the question because I am a newbie.

With this extension, is it possible for the same app as the extension to update itself or do I have to create an app1 to update app2?

If not, is there a way, for newbies, to have an app (hidden) inside another app (visible)?