Android Question Doing TAPs via Command Line

pbsys

Member
Licensed User
Hello There,

I am trying to do a TAP from my app using a command lines setences. I am using two rooted phones which basically run the below code, the problems is that on both phones when a ran this code the app gets hang and I never see if the TAP was performed.

In the other hand, if I ran these commands using the ADB sentences everything works just fine, any clue about what I could be doing wrong ??

Thank you in advance for your help with this issue.
pb

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")
 
Top