I am trying to interface my agent code to an Android App.
In a production android app, I would have the user login to the agent
code and get a response.
Can anyone suggest a way to do this using json in android app? I was thinking of HTTP get.
Here is my agent
code:
`device.on("senddata", function(state) {
// Set URL to your web service
local url = "https://agent.electricimp.com";
// Set Content-Type header to json
local headers = { "Content-Type": "application/json" };
// encode data and log
local body = http.jsonencode(state);
server.log("BODY " +body);
// send data to your web service
local request =http.post(url, headers, body);
local response = request.sendsync();
//server.log("response " +response);
return body;
//return response`