Dim args(1) As Object
Dim Obj1, Obj2, Obj3, Obj4 As Reflector
Dim size, i, flags, count As Int
Dim Types(1), msg, name As String
Obj1.Target = Obj1.GetContext
Obj1.Target = Obj1.RunMethod("getPackageManager") ' PackageManager
Obj2.Target = Obj1.RunMethod2("getInstalledPackages", 0, "java.lang.int") ' List<PackageInfo>
size = Obj2.RunMethod("size")
For i = 0 To size -1
Obj3.Target = Obj2.RunMethod2("get", i, "java.lang.int") ' PackageInfo
name = Obj3.GetField("packageName")
Obj3.Target = Obj3.GetField("applicationInfo") ' ApplicationInfo
flags = Obj3.GetField("flags")
If Bit.And(flags, 1) = 0 Then
'app is not in the system image
args(0) = Obj3.Target
types(0) = "android.content.pm.ApplicationInfo"
name = Obj1.RunMethod4("getApplicationLabel", args, types)
msg = msg & name & " : " & flags & CRLF
count = count + 1
End If
Next
Msgbox(msg,count)
Return