Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sending commands from a PC to an Android phone - via physical connection (USB, Serial, etc)

I'm working on a project to automate some tasks (such as play a song, play a video, receive bluetooth data, etc) on an Android phone from a PC.

Basically the PC will send a notifier to the phone and an app or something on the phone would then process the notifier and do 'something'. The opposite of this really: http://code.google.com/p/android-notifier/

I've seen some examples showing how to send commands to an Android listener app or service via a network connection, but in this case, I would much rather the transmission be over a physical connection.

USB Ideally, I'd like the connection to be via the USB port. But I've seen some posts online that suggest that the SDK does not natively support this. (Android apps, communicating with a device plugged in the USB port).

  • Is there some other SDK/API out there that makes this easier?
  • I've seen some posts on the ADB, but don't really get it... Would that work? (http://developer.android.com/guide/developing/tools/adb.html)

Serial over USB I've also seen some sites that show how to use a breakoutbox to perform bi-directional serial communication, but only with the G1. Is this possible with newer phones?

The Phone I'm open to really any newish phone. I'm currently looking at the Galaxy S, because it has the video out through the headphone jack. I'm open to rooting if need be.

like image 510
J J Avatar asked Jun 07 '11 15:06

J J


People also ask

Is there a way to control an Android phone from a PC?

Yes, you can easily control your Android phone from PC on the same Lan with AirDroid Personal. Download AirDroid Personal on your computer and click on the Telescope icon in the left bar. Then, choose the Android device from the available options. Finally, hit on “Remote Control” to establish the connection.


1 Answers

Implement a HTTP server in your app, then put your phone in USB Tether mode. This will create a local network between your phone and your PC. You should then be able to send HTTP request or create websockets using the phone's ip.

EDIT : I tested it, and it works, see here

like image 135
Rémy DAVID Avatar answered Nov 15 '22 01:11

Rémy DAVID