How does the Android server receive the key or mouse message from the client and determine whether it is a keyboard message or a mouse message

  android, question

Judging whether I can customize the KeyboardEvent of String type and MouseEvent to be Mouse Event and then go to if to judge, how should I implement it? Should I use json format to receive the judgment and then use json format to implement it directly? Or what should I do? This is my first project. This is my first contact with actual project. Please ask experienced great god for guidance and guidance. It is best to give me code point

The topic owner may not understand the respective functions of the client and the server.
First of all, it is possible to deal with keyboard and mouse events on the server side, but it can only be achieved through very careful design. The difficulty and cost are very high, and the whole software architecture was messed up carelessly.
In general, we will not handle events at the server.
Keyboard events and mouse events are generally client-side events. After triggering the events, the client-side shall handle the related matters properly. If network resources are needed, the required information shall be transferred to the server according to the agreed format, and the server shall then transfer the resources you need to you.
Here is an example.
Such as commonly used login modules.
There are two input boxes and a button on the interface. The input boxes are username input box userNameView and password input box passwordView. The button is btnSubmit.
The user will enter the user name and password first.
Then click btnSubmit. This is the time to handle the incident. We will do the following in the client first.

  • Text;

  • Text;

  • Simple preprocessing-> judging whether the input is empty? if(userName==””||password==””){return; bracket

  • If it is not empty, the information will be passed to the server, such as using get request.http://example.com/login.php?userName=user&password=passwd(Security issues are not considered as a demonstration)

  • The server returns the processing result (login successful? Failure? Cookie that return log-in status, etc.)
    It can be seen that it is impossible to obtain the user name and password at the server. This is also undesirable for the server to handle events.

Of course, this example is just to pass some simple data, more complex data can be passed by json, or other methods.