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

Moderator: leecollings

Post Reply
Timmiej93
Posts: 64
Joined: Saturday 26 December 2015 0:37
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

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

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

Post by SweetPants »

Take a look at domoticz-android source code. I believe it uses JSON. https://github.com/domoticz/domoticz-android
Timmiej93
Posts: 64
Joined: Saturday 26 December 2015 0:37
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post 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.
alfred_j_kwak
Posts: 110
Joined: Friday 20 September 2013 18:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 2.3530
Location: Finland
Contact:

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

Post 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...
Timmiej93
Posts: 64
Joined: Saturday 26 December 2015 0:37
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post 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.
User avatar
nayr
Posts: 354
Joined: Tuesday 11 November 2014 18: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 »

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: 64
Joined: Saturday 26 December 2015 0:37
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post 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!
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest