0

I'll come up with any excuse to get a chance to write my first Android application. I've never done much with it except for a couple of tutorials.

I've got a Windows application that controls a device, and the computer isn't necessarily right next to it. I think it would be great to be able to use my Droid to issue the device commands, but I'm not sure where exactly to start. I don't have a problem writing the GUI code or Java required to send commands to the PC, but it's the wireless connection to the PC that I don't know how to approach.

Bluetooth seems like a good choice. I have a USB-Bluetooth adapter, but no Bluetooth API on Windows. Can anyone suggest one? From reading other questions here on SO, it sounds like the 2.0 SDK has some sort of Bluetooth API, so that's good.

Another option is to use 802.11, and then write a web page / service that would allow the phone to issue commands to the device.

What have you all done to solve this sort of problem?

Dave
  • 14,618
  • 13
  • 91
  • 145

3 Answers3

1

I would use wifi, and if the commands you are sending are simple and won't change frequently then a custom protocol over a TCP connection would probably be simpler than HTTP.

But for HTTP maybe this is useful:

How to Consume WCF Service with Android

Community
  • 1
  • 1
Luke Dunstan
  • 4,862
  • 1
  • 17
  • 15
  • I finally got around to starting on this app, and using the wireless connection on my droid to connect to my app via TCP listener is how I'm going to execute commands. – Dave May 12 '10 at 06:30
0

I would make 2 apps: 1 for Android and 1 for Windows.

The Windows app would be the server while the Android app would be the client.

ZygD
  • 22,092
  • 39
  • 79
  • 102
Noah
  • 11
0

As an Android author I use a TCP Socket connection in all my apps that connect to the PC/Mac/Linux and come up with a TCP Socket protocol for the ASCII commands and responses.

I find it works very well.

Be careful using java.nio.SocketChannel vs the normal TCP Socket in Java as Android has some issues on different platforms with java.nio.SocketChannel I have discovered. Even between some HTC devices and others!

Melloware
  • 10,435
  • 2
  • 32
  • 62