It's through GET parameters. I can type in the following command in a
browser's URL box and it works:
http://192.168.0.12/output_format=xml&DeviceNum=13&action=SetTarget&newTargetValue=1

I'm used to sending commands through TCP sockets so I'm sure what's
the best way to send a URL command. I'm guessing the "opening" a URL
part isn't adequate.

On Sep 26, 8:49 pm, Jeffrey Blattman <jeffrey.blatt...@gmail.com>
wrote:
> you are opening a URL, then writing that URL to the stream you open at
> the URL. that's probably not what you wanted. what's the URL, and what
> is the "command" you are trying to pass? how does the endpoint accept
> the command? by reading POST data? through GET parameters?
>
> On 9/25/09 7:31 PM, HTN wrote:
>
>
>
>
>
> > I'm developing a remote app that sends commands via http. Normally I
> > type in a link in a browser and the command will work. With Android, I
> > would like it to work with a press of a button. I tried the following
> > code and it didn’t work:
>
> >             URL url = new URL(urlString);
>
> >              URLConnection connection = url.openConnection();
> >              connection.setDoOutput(true);
>
> >              OutputStreamWriter out = new OutputStreamWriter
> > (connection.getOutputStream());
> >            out.write(urlString);
> >            out.close();
>
> > "urlstring" is the http command link.
>
> > Any ideas? Am I on the wrong track? I'm confused because technically I
> > don't need to write anything to the link. I would think it would work
> > if I just open the connection.
>
> > Thanks.
>
> --
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to