Hi @Vinod_Kotiya Welcome to Kodular Community
Since I have not tested that method on all android versions so I am not sure on which versions it will not work.
Can you provide more details?
@vknow360 Please add this permission to the Manifest, to be able to uninstall package from devices with API > 28:
<uses-permission android:name="android.permission.REQUEST_DELETE_PACKAGES"/>
See here:
https://developer.android.com/reference/android/Manifest.permission
Great, and also add this permission:
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES"/>
to install package on devices with API > 25.
Thank you.
I have already added all necessary permissions and just going to test it
ChangeLog Verson 3
Changes
- Added necessary permissions in extension
Thanks to @bodymindpower - Fixed grammar and spelling mistakes
- Some internal changes to reduce aix size (16.1 > 14.2 KB)
Great service, updating so quickly.
It is one of the best extension developers
vknow360 Anke Hi, Thanks for your support. I am affraid. It is still not working. I tried new AIX, source code attached here.
Sunny this uninstall instruction is unresponsive. Hope you can find the glitch or give proper sample code. Thanks.
uninstall (4).aia (15.2 KB)
You might need to build your app, as those permissions above won’t work in companion
Eureka… Now it worked… as pointed out by Boban i should build it. It wont work in companion. Thanks anke, Taifun vknow360 here is final code… must built it to run…
uninstall (5).aia (15.2 KB)
Of course not with Companion, because the permission ( REQUEST_DELETE_PACKAGE
S) is not declared in Companion (apk).
And as I already said in the AI2 forum, you cannot uninstall a pre-installed system app (like YouTube). There is no problem to unintall all other apps.
Btw, if you post the same story also in the AI2 forum , then at least let us know.
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
.