Answer the question
In order to leave comments, you need to log in
How to emulate a tap on the screen or a mouse click?
Essence of the question: you need to remotely press a button on the smartphone screen (for example, turn on some application or something else) by coordinates. How can I achieve this without adb shell?
Answer the question
In order to leave comments, you need to log in
Good afternoon everyone.
As a result, the issue was resolved after installing root rights on Android and still through the commands in the terminal: input tap XY and input swipe X1 Y1 X2 Y2 .
public static Runtime rt;
public static Process process;
public static DataOutputStream os;
// Инициализируем переменные
rt = Runtime.getRuntime();
process = rt.exec("su");
os = new DataOutputStream(process.getOutputStream());
// Метод, исполняющий команды в терминале (можно выполнять в любом потоке).
// Примеры команд:
// input keyevent KEYCODE_VOLUME_DOWN
// input tap 200 300
public static void execCommands(String... commands)
{
try
{
for(int i = 0; i < commands.length; i++)
{
os.writeBytes(commands[i] + "\n");
os.flush();
}
} catch (Exception e) { }
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question