I am macking a custom navigation bar to Android 4.0.3.r1 and want to send key events like "Home" and "Back". My application is not a system therefore:
IWindowManager mWindowManager = IWindowManager.Stub.asInterface(
ServiceManager.getService(Context.WINDOW_SERVICE));
mWindowManager.injectKeyEvent( ev, false );
It doesn't work, because I can not get android.permission.INJECT_EVENTS
from not system application. How can I do this?
BaseInputConnection mInputConnection = new BaseInputConnection(targetView, true);
mInputConnection.sendKeyEvent(new KeyEvent(...));