1

I am trying to execute adb shell command from java by the help of Process

   String command = "adb shell dumpsys battery | findstr status";
   Process ps = Runtime.getRuntime().exec(command);

It return /system/bin/sh: findstr: not found

If I run the same command from command prompt and python script it display the expected result.

No_Rulz
  • 2,679
  • 1
  • 20
  • 33

1 Answers1

2

You cannot run adb on the mobile and the findstr command is AFIK only on windows. The linux equivalent grep is not allowed on the androids build in shell so you can just execute dumpsys battery and filter the relevent parts with your own code.

rekire
  • 47,260
  • 30
  • 167
  • 264