Android Question How to perform a tap from a background App

pbsys

Member
Licensed User
Hi there,

I wondering if somebody knows if it is possible to send a tap/click from a background application to another app running on foreground ?? I am new on android envirorment and I have no idea on how to do such kind of things.

I really appreciate any help on this matter.
Kindest Regards
pb
 

pbsys

Member
Licensed User
Hello Erel,

Thank you for your reply. I am using this piece of code which also would help me in my project if it were working.

I tried to use the INPUT TAP command from the command line in a rooted phone using "adb" command from a windows emulator and those commands works ok, but when I run those from the B4x code the phone gets hang, this happening on differents phones also rooted.

Any clue about what could be wrong ?

B4X:
Sub RunRootTAP (comando As String)
Dim Command, Runner As String
Dim StdOut, StdErr As StringBuilder
Dim Result As Int
Dim Ph As Phone

   Runner = File.Combine(File.DirInternalCache, "runner")
   Command = File.Combine(File.DirInternalCache, "command")
   File.WriteString(File.DirInternalCache, "runner", "su < " & Command)
   File.WriteString(File.DirInternalCache, "command", comando & CRLF & "exit") 'Any commands via crlf, and exit at end 
   StdOut.Initialize
   StdErr.Initialize
   Result = Ph.Shell("sh", Array As String(Runner), StdOut, StdErr)
End Sub

RunRootTAP("input tap 100 200")
 
Upvote 0
Top