-1

I want to kill process by PID from android SP using C# usually I write in commande line as shown the screenshoot

adb shell
run-as "com.android.commands.monkey"
ps | grep "com.android.commands.monkey"
kill -9 73254

73254 is the PID but it will change every time. So how do it with C# enter image description here

Med Amin
  • 57
  • 1
  • 4

1 Answers1

-1
# Kill myphoneexplorer process on SP
adb shell "am force-stop com.fjsoft.myphoneexplorer.client"
sleep 2
# Kill com.android.commands.monkey process on SP
adb shell "run-as com.android.commands.monkey"
adb shell "ps | grep com.android.commands.monkey"
for item in $(adb shell "ps | grep com.android.commands.monkey"); do
    if test "$item" != ""
    then
        arr+=($item)
        echo ${arr[1]}
        adb shell "kill -9 ${arr[1]}"
    fi

done
sleep 2
sleep 10
Med Amin
  • 57
  • 1
  • 4