Android Question Programmatically uninstall app on Android 11

biometrics

Active Member
Licensed User
Longtime User
I have been using this code in a service to initiate the uninstall of our setup app for many years.

The devices we use have been upgraded from Android 7 to Android 11.

This code doesn't initiate the uninstall anymore.

I've stripped the code to the bare essential to demonstrate the problem but there is other code that checks if an uninstall should be initiated etc.

B4X:
Sub Service_Start (StartingIntent As Intent)
    Dim In As Intent

    In.Initialize("android.intent.action.DELETE", "package:biometrics.setup")
    StartActivity(In)   
End Sub

Please recommend how one can initiate an app's uninstall on Android 11.
 

drgottjr

Expert
Licensed User
Longtime User
permission needed: android.permission.REQUEST_DELETE_PACKAGES. i don't believe it's runtime, but check for dangerous permissions in the ide pop-up after you add it to the manifest. easy enough to remedy if it is. (also think about Intent.ACTION_UNINSTALL_PACKAGE if android.intent.action.DELETE doesn't do it)
 
Upvote 0

biometrics

Active Member
Licensed User
Longtime User
permission needed: android.permission.REQUEST_DELETE_PACKAGES. i don't believe it's runtime, but check for dangerous permissions in the ide pop-up after you add it to the manifest. easy enough to remedy if it is. (also think about Intent.ACTION_UNINSTALL_PACKAGE if android.intent.action.DELETE doesn't do it)
Thanks, will try tomorrow.
 
Upvote 0

biometrics

Active Member
Licensed User
Longtime User
Only had a chance to try it now, can confirm this works when added to the manifest for Android 11:

B4X:
AddPermission(android.permission.REQUEST_DELETE_PACKAGES)
 
Upvote 0
Top