How to run a shell command?
Posted: Mon Apr 08, 2019 11:43 am
Hi, I want to turn off and lock the screen when I double-tap on an empty space.
I have found a way to turn off and lock by a shell command. It is: su -c "/system/bin/input keyevent 26"
It works fine with termux.
I have written to the LL's author, and he told me to write this script, and assign it to a double-tap action:
bindClass('java.lang.Runtime');
Runtime.getRuntime().exec('su -c "/system/bin/input keyevent 26"');
But it doesn't work. The screen is not turned off when I double-tap. The only reaction is a message that LL has been granted root privileges.
I tried to look this up in google, and it seems like a proper way of running shell commands from Java.\
What can I do to make it working?
I have found a way to turn off and lock by a shell command. It is: su -c "/system/bin/input keyevent 26"
It works fine with termux.
I have written to the LL's author, and he told me to write this script, and assign it to a double-tap action:
bindClass('java.lang.Runtime');
Runtime.getRuntime().exec('su -c "/system/bin/input keyevent 26"');
But it doesn't work. The screen is not turned off when I double-tap. The only reaction is a message that LL has been granted root privileges.
I tried to look this up in google, and it seems like a proper way of running shell commands from Java.\
What can I do to make it working?