Ibad Khan Ibad Khan - 26 days ago 8
Java Question

Remote access implementation in Android

Want to implement remote access app on android. As I'm still amateur in Android, needed some pointers on implementation of remote access app.

In which I should be able to provide


  1. A screen that is similar to monitor, keep itself updating at regular interval.

  2. A mouse pointer & additional (functional & control) key's to the existing keyboard in Android.



Any advice regarding this ? feel free to provide. :-)

Thanks in advance.

Answer

If I am not understanding wrong, you want remote access to your desktop computer from an Android phone?

Ok, you need to do the following:

  1. Write a simple server application listening on a local port in your desktop. This application understands some commands which you pre-define to represent all kinds of actions you perform on a desktop computer, and when it receives a command from clients, it executes the command accordingly, such as moving the mouse cursor, right click, etc. Here you will use java.awt.Robot.

  2. Write an android application which connects to the server application, send commands to it, you can do all this using Java sockets.

  3. For making the screen like a monitor and updating the display regularly, you need to keep a long-live connection from the client to the server, and the screen will take screenshots of the current desktop screen at a pre-defined interval(we call it fps, or Frame Per Second) and stream the frames to the client, the client will take that raw data to build a Bitmap, and draw that bitmap on a canvas, or you can simply build a Drawable from the bitmap, and set the Drawable image to a ImageView. Here you will also use java.awt.Robot to take screenshots in the server application.