List of all apps installed by the user?

Kiffi

Well-Known Member
Licensed User
Longtime User
Hello,

with the following snippet i am able to get a list of all packages on my phone:

B4X:
Dim pm As PackageManager
Dim packages As List
packages = pm.GetInstalledPackages
For i = 0 To packages.Size - 1
    Log(packages.Get(i))
Next

But how to get a list of all packages installed by the user? (all Apps i am able to uninstall)

Thanks & Greetings ... Kiffi
 

wes58

Active Member
Licensed User
Longtime User
I have been using similar code to get the list of applications and application icons and it worked ok, until I upgraded the phone to Lollipop.
Now I get an error on line Dim bdw As BitmapDrawable = pm.GetApplicationIcon(p): "java.lang.ClassCastException: android.graphics.drawable.VectorDrawable cannot be cast to android.graphics.drawable.BitmapDrawable" . When the error is dismissed, it still displays the icon in the listview OK OK.


Edit: Now, I had noticed that it only happens for one application com.android.systemui
 
Last edited:
Upvote 0

wes58

Active Member
Licensed User
Longtime User
You can use a Try Catch block to skip this app.

Thanks Erel. I looked for the package name "com.android.systemui" and skipped it when it was in the the loop. But it will be safer to use try-catch as you suggested, just in case (in future) there are other applications with this problem.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…