Android Question when p.shell ping,main thread is blocked.how to change ?

hears

Active Member
Licensed User
Longtime User
B4X:
Dim p As Phone
Dim sb As StringBuilder
    sb.Initialize
    p.Shell("ping -c 1 192.168.0.1",Null,sb,Null)
Log(sb)

in my app must use ping function
,cannot use http test.

so main thread alway stop.how to do ?

how to start a new thread PING ?
after just display ping result in main activity.
 

walterf25

Expert
Licensed User
Longtime User
B4X:
Dim p As Phone
Dim sb As StringBuilder
    sb.Initialize
    p.Shell("ping -c 1 192.168.0.1",Null,sb,Null)
Log(sb)

in my app must use ping function
,cannot use http test.

so main thread alway stop.how to do ?

how to start a new thread PING ?
after just display ping result in main activity.
You can use a timer and set the timer to fire up every few milliseconds or whatever your need to ping is, you could also probably try a Service and schedule the service to run every few milliseconds.

Regards,
Walter
 
Upvote 0
Top