Anke
October 28, 2020, 2:45pm
8
I made an update and added some methods for creating subdirectories in the ASD as suggested by @Taifun :
Version 2 (Oct 28, 2020)
de.bodymindpower.InstallAPK.aix (9.6 KB)
You can now create the /Download
dir in the ASD:
/storage/emulated/0/Android/data/edu.mit.appinventor.aicompanion3/files/Download/
and also subfolders in this dir, e.g.:
/storage/emulated/0/Android/data/edu.mit.appinventor.aicompanion3/files/Download/myAPKs/
2 Likes
patel
October 28, 2020, 6:15pm
10
sorry for my beginner question, what's the advantage of installing an APK to ASD ?
Anke
October 28, 2020, 6:19pm
11
See in the description above:
patel
October 28, 2020, 6:26pm
12
I put my question wrong, why to make an app for installing another app ?
Anke
October 28, 2020, 6:55pm
13
There can be a variety of reasons.
Maybe you want to ask a user who was looking for it:
Hi!
I want to use @Anke 's Install APK extension.
She wrote DeepHost's download extension is not require permission to download specific directory so i use that.
[snip]
I tried with original download path -android download directory-. Checking the download path showed that correctly.
Gave error:
Failed resolution of: Landroid/support/v4/content/FileProvider
I thouth its ok, because Install APK extension need the appspecific directory. I modified as in Anke's example. As the picture shows. …
Zol
October 29, 2020, 9:28am
14
As Anke wrote there can be many reasons.
For example, in my current project i don't use playstore because of lead time and it is a private app, so i use the extension for self install the newest version from our own server. Of course it can be download and install manually, but not every user is software- and phone-guru so i make it easier for them.
I only wish it would be possible to avoid click on isntall too.
Dear Anke,
An error occurred such as image1
Apk (MIT AI) is run on an android version such as image2
Anke
October 30, 2020, 10:47am
17
Show your blocks.
And try this test APK:
I have now created an extension that can also be used to download and install an APK with AI2 (using AndroidX libs). It should work with all versions of Android. The given download link (GoogleDrive) downloads an almost empty APK (only one button, 3.2 MB). But you can also set your own link to your app (APK).
So check that on your devices with different Android versions, especially Android 10 and 11.
[grafik]
Does it work on your device?
Which device and Android version do you have?
Anke
October 30, 2020, 7:18pm
18
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.
Anke
October 30, 2020, 11:15pm
20
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
Is the version of de.bodymindpower.InstallAPK.aix that I am using compatible (the version shown in the picture)?
BestRegards,
Boike_Rimba
Anke
November 1, 2020, 7:02am
22
Yes, but I still need to add a "Download.Completed" event, as @Taifun said:
thank you for your contribution
there is only one minor issue... the method DownloadFileToASD is an asynchronous method and usually there should be an event to indicate, that the download has been finished...
therefore you might want to replace your method FileDownloadedToASD by that event
Thank you
Taifun
Trying to push the limits! Snippets , Tutorials and Extensions from Pura Vida Apps by [image] Taifun.
You have to wait for the download to complete:
Anke
November 1, 2020, 9:22am
24
@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).
Anke
November 1, 2020, 11:14am
25
@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.