Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

set mouse position on rooted android device

Kind of related to this.

On a rooted Android phone, how do I set the position of the mouse from within an app. (The mouse is a bluetooth mouse.)

The other question mentioned it's possible with root or ADB, but not how.

like image 226
Jeroen Avatar asked Jan 03 '15 17:01

Jeroen


1 Answers

You can use this library to inject events: https://github.com/radhoo/android-event-injector

And add mouse move event method in Events.java, below is a example to send a relative mouse move event:

    public int sendMouseMove(int deltaX, int deltaY) {
        intSendEvent(m_nId, EV_REL, REL_X, deltaX);
        intSendEvent(m_nId, 0, 0, 0);
        intSendEvent(m_nId, EV_REL, REL_Y, deltaY);
        intSendEvent(m_nId, 0, 0, 0);
        return 0;
    }
like image 83
bladefury Avatar answered Sep 25 '22 00:09

bladefury