user3053246 user3053246 - 1 year ago 201
Android Question

Android - how to stop continuous terminal action (ping) programmaticaly?

I am working on a simple app but don't know how to stop continuous action in terminal such as PING programmatically.

I just want to know the command, then I'll add it to runtime.getruntime.exec...

I know there's a CTRL+C shortcut in pc but how do I execute this on Android?

Sorry for not adding examples, I'm writing from my phone.

Answer Source

You can't directly send CTRL + C, but take a look at Process.sendSignal() (Android Developers)

First, get the process ID of the ping-process. Then you can easily send a Process.sendSignal(yourPid, Process.SIGNAL_QUIT);

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download