Page 1 of 1

Anyone ever tried sending a simple json command from an app?

Posted: Tuesday 26 January 2016 21:46
by Timmiej93
So has anyone ever tried creating a simple app that sends a json command to control domoticz on a buttonpress? I've been looking all over the internet for something that just does the same as 'curl' does in shell/bash, but it doesn't seem to exist.
I'm pretty new to Android developing, so I don't need anything fancy by a long stretch, I simply need a proof of concept. Something that just has a button which I can click, which sends out a json command, like setting the brightness of a lamp.

If anyone can help me, or point me in the right direction, that would be truly awesome. I've asked the same question on some other forums, but the general response is "You're stupid, just look it up", but I haven't got a clue what to look for.

Re: Anyone ever tried sending a simple json command from an

Posted: Tuesday 26 January 2016 21:52
by SweetPants
Take a look at domoticz-android source code. I believe it uses JSON. https://github.com/domoticz/domoticz-android

Re: Anyone ever tried sending a simple json command from an

Posted: Tuesday 26 January 2016 22:02
by Timmiej93
Thank you. I will go through that, but I can barely make out what everything does, so it'll be hard for me to find out what everything actually does.
So if anyone has more tips / examples on a simple way to send the JSON command, that would be great.

Re: Anyone ever tried sending a simple json command from an

Posted: Tuesday 26 January 2016 22:43
by alfred_j_kwak
Don't know thing about Android programming, but how about this?
http://www.mkyong.com/android/android-button-example/

Or this?
http://hmkcode.com/android-send-json-data-to-server/

So google is your friend...

Re: Anyone ever tried sending a simple json command from an

Posted: Tuesday 26 January 2016 22:49
by Timmiej93
Well, like I said, I don't really know what I'm looking for. I've actually seen that first post so often, but never realised it could be of any use (I've literally seen hundreds of pages in my search, so I've overlooked some stuff probably.
I'll have a look into it tomorrow, thanks.

Re: Anyone ever tried sending a simple json command from an

Posted: Wednesday 27 January 2016 4:12
by nayr
check out at the android remote in my sig.. would be a piece of cake to modify it for a mobile android.

Re: Anyone ever tried sending a simple json command from an

Posted: Thursday 28 January 2016 18:59
by Timmiej93
nayr wrote:check out at the android remote in my sig.. would be a piece of cake to modify it for a mobile android.
Holy S, it actually worked! Thanks a ton, that was exactly the example I needed!