class Process2:Thread(){
override fun run() {
var string:String="input keyevent "+25;
var process: Runtime? =Runtime.getRuntime();
process?.exec(string)
}
}
When the app goes to the background ,This code doesn't work in the background, How do I make it work in the background?
Tried many methods. You can even monitor the volume, but you can't monitor the keyEvent 24 and 25. I just want to lie down and read with the Bluetooth remote control. But it can certainly be realized, because there are many Bluetooth remote controls to buy. Of course, it can be realized, but how to do it is still a problem
var string:String="input keyevent "+24+"\n";
var process:Process = Runtime.getRuntime().exec("/system/bin/sh");
DataOutputStream os = new DataOutputStream(processKeyEvent.getOutputStream());
var os:DataOutputStream= DataOutputStream(process.outputStream)
os.writeBytes(string);
It's no use