Android Question Get installed app in Android

darabon

Active Member
Hello,
I need to get installed applications on the Android
The found solution is:

B4X:
Private Sub ShowInstalledApps
   Dim pm As PackageManager  'phone library
   For Each pck As String In pm.GetInstalledPackages
     Dim name As String = pm.GetApplicationLabel(pck)
     Log(name)
   Next
End Sub

My question is Does the codes compatible with all android versions?
In my app, I have to give a score user after installing app and that is important that I can get the installed app
Thanks
 

agraham

Expert
Licensed User
Longtime User
You need to put this in your manifest

AddManifestText(<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"/>)

But then Google will not allow it in the Play Store without good reason.

 
Upvote 0

darabon

Active Member
You can query for the existence of specific apps with something like this
AddManifestText(<queries>
<package android:name="com.fake.app" />
<package android:name="com.fake.game" />
</queries>)
The apps are not specified and can be any app so your code is not compatiable for my app
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…