You need to get an instance of ModuleAndroidKeyboard then call start() on that.
public class ModuleAndroidKeyboard extends Thread {
@Override
public void run() {
Instrumentation inst = new Instrumentation();
inst.sendKeyDownUpSync(KeyEvent.KEYCODE_MEDIA_NEXT);
}
}
ModuleAndroidKeyboard module = new ModuleAndroidKeyboard();
module.start(); // this line executes the codes of run()
To learn more about Thread in Java, visit W3Schools
2
Answers
I figured it out, I had to sign the apk with a system certificate and register INJECT_EVENTS in the manifest, after which everything worked.
You need to get an instance of
ModuleAndroidKeyboard
then callstart()
on that.To learn more about
Thread
in Java, visit W3Schools