无法将thingpeak json传递给android

时间:2017-02-12 06:19:52

标签: android json

我把传感器读取了bmp180并传递给了thingpeak并且显示了图形。现在我想把thingpeak的json带到我的android手机上。但是在thingpeak数据中的json没有进入我的手机。任何帮助都会不胜感激。这是我的代码:

   gphoto2 --capture-image-and-download

1 个答案:

答案 0 :(得分:2)

field2并不存在于Json响应的Feed部分中。

尝试更改

String address = eachData.getString("field2");

String address = eachData.getString("field1");

来自您网址的截断回复:

{
   "channel":{
      "id":201342,
      "name":"Weather Monitoring Station",
      "description":"The channel provides live weather information of the city such as temperature and atmospheric pressure.",
      "latitude":"0.0",
      "longitude":"0.0",
      "field1":"Temperature",
      "field2":"Pressure",
      "created_at":"2016-12-09T08:32:45Z",
      "updated_at":"2017-02-10T15:46:27Z",
      "last_entry_id":371
   },
   "feeds":[
      {
         "created_at":"2017-01-26T07:33:03Z",
         "entry_id":272,
         "field1":"29.57"
      },
      {
         "created_at":"2017-01-26T07:33:25Z",
         "entry_id":273,
         "field1":"29.61"
      }
      ....
   ]
}