Note: InstallApp
does not seem to work on Android > 5:
un_installAPK.apk (9.9 MB)
See also here:
Hi
Can you send me the logcat?
Itās likely not an issue with their device. Itās your method that you are using.
@bodymindpower can you try the method I used in my extension? If it works for you Iāll hand over the snippet. It works on Android O for me.
Thank you @hammerhai
I am using same method but with a modification.
Here is my code:
public void InstallApp(String apkFilePath){
File f = new File(apkFilePath);
if (f.exists()){
try {
Intent intent = new Intent("android.intent.action.VIEW");
intent.setDataAndType(Uri.fromFile(f), "application/vnd.android.package-archive");
context.startActivity(intent);
}catch (Exception e){
e.printStackTrace();
}
}
}
Use thisā¦
java.io.File apk = new java.io.File(file);
Intent intent = new Intent("android.intent.action.VIEW");
intent.addCategory("android.intent.category.DEFAULT");
intent.setDataAndType(Uri.fromFile(apk), "application/vnd.android.package-archive");
context.startActivity(intent);
Of course you can modify it to your liking with checking if the file exists.
Ooopsā¦I posted code of v4
In version 3 I am using same code (I mean with category).
I thought that issue is due to specifying Category
so I removed that.
Remove the try-catch
then come back with V4. In any of the examples, if you were paying attention, there is no try-catch
.
Sure.
But I donāt think it is because of try-catch
.
Letās see if your work.
Which extension?
Think you found it just go to the Archive component and you should find the block
Great, works, but I wouldnāt have supposed it there, but rather at AppManager.
I first checked with Companion: works.
But APK seems to fail.
Hmmm. Did you check your path for both of ours? Try /mnt/sdcard/Downloads/filename.apk