hears Active Member Licensed User Longtime User Jun 5, 2018 #1 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.
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 Jun 5, 2018 #2 hears said: 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. Click to expand... 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
hears said: 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. Click to expand... 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
Erel B4X founder Staff member Licensed User Longtime User Jun 6, 2018 #3 A timer will not help here. Wait for v8.30 to be released. It will include a ShellAsync method. Upvote 0