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

Post Reply
Timmiej93
Posts: 14
Joined: Saturday 26 December 2015 1:37
Target OS: Raspberry Pi
Domoticz version:
Contact:

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

Post by Timmiej93 » Tuesday 26 January 2016 22:46

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.

SweetPants
Posts: 1514
Joined: Friday 12 July 2013 21:24
Target OS: Linux
Domoticz version: V3.8590
Location: The Netherlands
Contact:

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

Post by SweetPants » Tuesday 26 January 2016 22:52

Take a look at domoticz-android source code. I believe it uses JSON. https://github.com/domoticz/domoticz-android

Timmiej93
Posts: 14
Joined: Saturday 26 December 2015 1:37
Target OS: Raspberry Pi
Domoticz version:
Contact:

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

Post by Timmiej93 » Tuesday 26 January 2016 23:02

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.

alfred_j_kwak
Posts: 253
Joined: Friday 20 September 2013 18:49
Target OS: Raspberry Pi
Domoticz version: 2.3530
Location: Finland
Contact:

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

Post by alfred_j_kwak » Tuesday 26 January 2016 23:43

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...

Timmiej93
Posts: 14
Joined: Saturday 26 December 2015 1:37
Target OS: Raspberry Pi
Domoticz version:
Contact:

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

Post by Timmiej93 » Tuesday 26 January 2016 23:49

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.

User avatar
nayr
Posts: 430
Joined: Tuesday 11 November 2014 19:42
Target OS: Linux
Domoticz version: github
Location: Denver, CO - USA
Contact:

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

Post by nayr » Wednesday 27 January 2016 5:12

check out at the android remote in my sig.. would be a piece of cake to modify it for a mobile android.
Debian Jessie: CuBox-i4 (Primary) w/Static Routed IP and x509 / BeagleBone with OpenSprinkler / BeagleBone Planted Aquarium / 3x Raspbery Pi2b GPIO Slaves
Elemental Theme - node-domoticz-mqtt - Home Theatre Controller - AndroidTV Simple OSD Remote - x509 TLS Auth

Timmiej93
Posts: 14
Joined: Saturday 26 December 2015 1:37
Target OS: Raspberry Pi
Domoticz version:
Contact:

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

Post by Timmiej93 » Thursday 28 January 2016 19:59

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!

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests