Home » Android » java – Controlling your phone from laptop

java – Controlling your phone from laptop

Posted by: admin May 14, 2020 Leave a comment

Questions:

Idea: create a remote control for your android phone.

Why: I like listening music on my phone in a dock station with speakers connected. Now sometimes I want to turn the volume up/down, change the song, etc. So I need to unlock the phone, locate app that is playing music (Music player, internet radio app, etc.). Sometimes I manage to undock the phone or just mess something up and generally this s*cks.

So I would like to control my phone (on a data connection, not wifi) from the laptop (on wifi).

I had investigated couple of approaches and would like to get some recommendations on them:

  1. Use XMPP. This is nice as there a lots of free XMPP services I can use. Two libraries (both based on smack) that I tried work just fine (Flow aSmack port and Beem smack port). I could automatically create new user on device and present some id/password combination that I (user) would enter on a desktop side to link both devices.

  2. Use JXTA. Should be the next real deal but could be an overkill. I would imagine running a rendezvous&relay server somewhere (need to get hosting to work around firewall/NAT) and creating a peer group protected with password. Use device unique id and password (withing group) to link to the desktop application. (A great eBook explaining p2p and JXTA can be downloaded from here).

  3. Use C2DM. Could be the answer, but notification delivery sometimes can take more then couple of seconds to deliver and there would be no feedback mechanism.

So far first solutions looks like a lot easier choice. Create custom extension or just create chat between both endpoints and use that for relaying commands/messages. But I wonder if I would be abusing XMPP system?

JXTA sounds great, but from all the reading I done it is apparent that it is designed for group communication and service sharing and not a solution for connecting two endpoints.

What do you guys think? I welcome all suggestions too.

UPDATE I do not want to remote to a phone and interactively control it. I want to establish a connection (socket connection) between laptop and phone even if both of them are on different networks secured behind firewalls, routers. With this I could define a protocol to issue commands to the phone (lower volume, mute, start app, etc.).

UPDATE 2 I’m giving JXTA a shot. It is a nice solution but lack of documentation is a bit of a downer. Got VPS FreeBSD server to test RDV/relay side of things. I keep updating this question further as it may be helpful for others.

UPDATE 3 Some more reading:

UPDATE 4
So far I did not have enough time to further continue my project. I did find an interesting project. At the moment project owners are re-writing their library, you can track their progress here.

How to&Answers:

why do not you try installing VNC server on machine and then use VNC client on laptop to access mobile

Answer:

Mobile Shell (Mosh) maybe just the tool you are looking for. I have been looking for a good project to use Mosh, your idea seems pretty interesting 🙂