Sub Process_Globals
End Sub
Sub Globals
End Sub
Sub Activity_Create(FirstTime As Boolean)
Dim btnSetar As Button
btnSetar.Initialize("btnSetar")
btnSetar.Text = "Setar"
Activity.AddView(btnSetar,35%x,45%y,120dip,50dip)
End Sub
Sub btnSetar_Click
Dim args(1),args2(3), pack() As Object
Dim Obj1, Obj2, Obj3, Obj4, Obj5, Obj6 As Reflector
Dim size, i, flags, count As Int
Dim Types(1),Types2(3), 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 = "PackName: "&Obj3.GetField("packageName")
Obj4.Target = Obj3.GetField("applicationInfo") ' ApplicationInfo
flags = Obj4.GetField("flags")
args(0) = Obj4.Target
Types(0) = "android.content.pm.ApplicationInfo"
name = name & " - Label: " &Obj1.RunMethod4("getApplicationLabel", args, Types)
msg = msg & name & " : " & flags & CRLF
count = count + 1
If Obj1.RunMethod4("getApplicationLabel", args, Types) == "Reflector Demo" Then
args2(0) = Obj3.GetField("packageName")
args2(1) = 2
args2(2) = 0
Types2(0) = "java.lang.String"
Types2(1) = "java.lang.int"
Types2(2) = "java.lang.int"
Obj6.Target = Obj6.GetContext
Obj6.Target = Obj6.RunMethod("getPackageManager")
Obj6.Target = Obj6.RunMethod4("setApplicationEnabledSetting", args2, Types2)
ToastMessageShow("ENNNTROU IF",True)
End If
Next
Msgbox(msg,count)
End Sub