Tuesday, April 24, 2012

Send data to an android device through a text input form php

Here is the idea:

enter image description here

The user types in a command which it has to be send to an android device.

Then the android device runs the command and returns the result to the php page which displays the result in the page!

I have tried with sockets but with no luck(i wanted to keep a connection alive until the closure of the page).

I know how to run commands in my android device:

Runtime.getRuntime().exec( command,args);

And I also know how to send data to the php server:

HttpPost httppost = new HttpPost(""); 


The problem is that I want to send data to the android device first via the text box after pressing the submit button.

Is there a way to do this? Is HttpPost a wrong way to do this?

I have tried so many things like:

URL url = new URL(SERVER_URL);
URLConnection connection = url.openConnection();


No comments:

Post a Comment