error: cannot find symbol INJECT_INPUT_EVENT_MODE_ASYNC

21 Views Asked by At

I'm trying to generate a motionEvent in Android Background Service, so that Any other Android Application can receive the motionEvent. But, when compiling the following java code, the error says that error: cannot find symbol INJECT_INPUT_EVENT_MODE_ASYNC. How can fix it ?

===============================================================
MyForeGroundService.java:132: error: cannot find symbol iMgr.injectInputEvent(event, InputManager.INJECT_INPUT_EVENT_MODE_ASYNC); symbol: variable INJECT_INPUT_EVENT_MODE_ASYNC location: class InputManager

MyForeGroundService.java
MotionEvent event = MotionEvent.obtain(downTime, downTime, MotionEvent.ACTION_MOVE,
        1, pp, pointerCoords, 0, 0, 0, 0, 31, 0, InputDevice.SOURCE_JOYSTICK, 0);
try {
    InputManager iMgr = (InputManager) getSystemService(INPUT_SERVICE);
    if (iMgr != null) {
         iMgr.injectInputEvent(event, InputManager.INJECT_INPUT_EVENT_MODE_ASYNC);
                    

...

0

There are 0 best solutions below