Alain75
Member
Hi,
I developed a package manager which lists all the packages installed on the smartphone. I integrated the B4A accessibility library v0.11 and I am able to perform click on the "Force stop" button shown on the application details settings with PerformNodeActionOnViewWithArgs.
To go further, I tried to display the Storage sub screen of the application details settings in order to empty its cache. As the PerformNodeActionOnViewWithArgs method doesn't perform the click, I wrote a sub which identifies the nodeinfo and performs a click action on it. Unfortunately, with no any more success... Below is the code :
Any Idea ?
I developed a package manager which lists all the packages installed on the smartphone. I integrated the B4A accessibility library v0.11 and I am able to perform click on the "Force stop" button shown on the application details settings with PerformNodeActionOnViewWithArgs.
To go further, I tried to display the Storage sub screen of the application details settings in order to empty its cache. As the PerformNodeActionOnViewWithArgs method doesn't perform the click, I wrote a sub which identifies the nodeinfo and performs a click action on it. Unfortunately, with no any more success... Below is the code :
Extract:
Sub evt_OnAccessibilityEvent (event As Object, node As Object)
...
' todo is action to perform
Select todo.ToLowerCase()
Case "back": Ok = svc.PerformGlobalAction(kst.GLOBAL_ACTION_BACK)
Case "down": Ok = svc.PerformNodeActionOnViewWithArgs(True,"android:id/title",kst.ACTION_SCROLL_FORWARD,Null)
Case "clic": Ok = ClicText(node,"Stockage")
Case Else: Ok = svc.PerformNodeActionOnViewWithArgs(todo.contains(":id/"),todo,kst.ACTION_CLICK,Null)
End Select
...
end sub
Sub ClicText(node As Object,text As String) As Boolean
Dim ln As List = node
ln = ln.Get(0)
For i=0 To ln.Size-1
If GetString(ln.Get(i),"getText")=text Then
Log("Clic on "&text)
Try
'ln.Get(i).As(JavaObject).RunMethod("performAction",Array(kst.ACTION_FOCUS)) 'unusefull
'ln.Get(i).As(JavaObject).RunMethod("performAction",Array(kst.ACTION_SELECT)) 'unusefull
Return ln.Get(i).As(JavaObject).RunMethod("performAction",Array(kst.ACTION_CLICK))
Catch
Log(LastException)
Return False
End Try
Exit
End If
Next
Return False
End Sub
Sub GetString (jo As JavaObject,mt As String) As String
Try
Dim txt As String = jo.RunMethod(mt,Null)
Catch
txt = "error"
End Try
Return txt
End Sub
Any Idea ?