Reputation: 11
I have requirement like i need to take a UI dump of each window that appears on my android app to verify resource-id given is unique.
basically i want do what this command "adb shell uiautomator dump" does inside the android app.
Upvotes: 1
Views: 8594
Reputation: 3208
@CommonsWare may be correct. But I tested the code below on two non-rooted devices and I was able to get an output. (Nexus 6P and Samsung S5)
@Gokul
I found the key was to NOT specify "adb shell" beforehand as it must be in the path already and I get a permission error if I attempt to use it.
Doing something like this:
String command = "service list";
Process process = Runtime.getRuntime().exec(command);
Worked for me running in a unit test on two real non-rooted devices.
This produces the same results as running the command: "adb shell service list"
from the command prompt.
Upvotes: 2