码迷,mamicode.com
首页 > 移动开发 > 详细

Android 车联网天气

时间:2015-01-19 12:19:46      阅读:207      评论:0      收藏:0      [点我收藏+]

标签:

天气查询http://developer.baidu.com/map/index.php?title=car/api/weather

 

http://api.map.baidu.com/telematics/v3/weather?location=%E8%8B%8F%E5%B7%9E&output=json&ak=640f3985a6437dad8135dae98d775a09

{
"error": 0,
"status": "success",
"date": "2015-01-19",
"results": [
{
"currentCity": "苏州",
"pm25": "167",
"index": [],
"weather_data": [
{
"date": "周一 01月19日 (实时:8℃)",
"dayPictureUrl": "http://api.map.baidu.com/images/weather/day/qing.png",
"nightPictureUrl": "http://api.map.baidu.com/images/weather/night/duoyun.png",
"weather": "晴转多云",
"wind": "北风3-4级",
"temperature": "10 ~ 3℃"
},
{
"date": "周二",
"dayPictureUrl": "http://api.map.baidu.com/images/weather/day/yin.png",
"nightPictureUrl": "http://api.map.baidu.com/images/weather/night/yin.png",
"weather": "阴",
"wind": "东南风3-4级",
"temperature": "10 ~ 5℃"
},
{
"date": "周三",
"dayPictureUrl": "http://api.map.baidu.com/images/weather/day/yin.png",
"nightPictureUrl": "http://api.map.baidu.com/images/weather/night/duoyun.png",
"weather": "阴转多云",
"wind": "西风4-5级",
"temperature": "11 ~ 1℃"
},
{
"date": "周四",
"dayPictureUrl": "http://api.map.baidu.com/images/weather/day/qing.png",
"nightPictureUrl": "http://api.map.baidu.com/images/weather/night/duoyun.png",
"weather": "晴转多云",
"wind": "西北风4-5级",
"temperature": "8 ~ 1℃"
}
]
}
]
}

 

http://api.map.baidu.com/telematics/v3/weather?location=%E8%8B%8F%E5%B7%9E&output=xml&ak=640f3985a6437dad8135dae98d775a09

<CityWeatherResponse>
<error>0</error>
<status>success</status>
<date>2015-01-19</date>
<results>
<currentCity>苏州</currentCity>
<weather_data>
<date>周一 01月19日 (实时:8℃)</date>
<dayPictureUrl>
http://api.map.baidu.com/images/weather/day/qing.png
</dayPictureUrl>
<nightPictureUrl>
http://api.map.baidu.com/images/weather/night/duoyun.png
</nightPictureUrl>
<weather>晴转多云</weather>
<wind>北风3-4级</wind>
<temperature>10 ~ 3℃</temperature>
<date>周二</date>
<dayPictureUrl>
http://api.map.baidu.com/images/weather/day/yin.png
</dayPictureUrl>
<nightPictureUrl>
http://api.map.baidu.com/images/weather/night/yin.png
</nightPictureUrl>
<weather></weather>
<wind>东南风3-4级</wind>
<temperature>10 ~ 5℃</temperature>
<date>周三</date>
<dayPictureUrl>
http://api.map.baidu.com/images/weather/day/yin.png
</dayPictureUrl>
<nightPictureUrl>
http://api.map.baidu.com/images/weather/night/duoyun.png
</nightPictureUrl>
<weather>阴转多云</weather>
<wind>西风4-5级</wind>
<temperature>11 ~ 1℃</temperature>
<date>周四</date>
<dayPictureUrl>
http://api.map.baidu.com/images/weather/day/qing.png
</dayPictureUrl>
<nightPictureUrl>
http://api.map.baidu.com/images/weather/night/duoyun.png
</nightPictureUrl>
<weather>晴转多云</weather>
<wind>西北风4-5级</wind>
<temperature>8 ~ 1℃</temperature>
</weather_data>
<index></index>
<pm25>167</pm25>
</results>
</CityWeatherResponse>

 

学员资料:

在网上找到一个更详细的天气信息

http://wthrcdn.etouch.cn/weather_mini?city=深圳
通过城市名字获得天气数据,json数据
http://wthrcdn.etouch.cn/weather_mini?citykey=101280601
通过城市id获得天气数据,json数据

http://wthrcdn.etouch.cn/WeatherApi?citykey=101280601
通过城市id获得天气数据,xml文件数据,
当错误时会有<error>节点
http://wthrcdn.etouch.cn/WeatherApi?city=深圳
通过城市名字获得天气数据,xml文件数据

Android 车联网天气

标签:

原文地址:http://www.cnblogs.com/xubuhang/p/4233150.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!