每日天气预报
每日天气预报Android SDK,提供全球城市未来3-30天天气预报,包括:日出日落、月升月落、最高最低温度、天气白天和夜间状况、风力、风速、风向、相对湿度、大气压强、降水量、露点温度、紫外线强度、能见度等。
| 接口代码 | 接口 | 数据类 |
|---|---|---|
| weather3d | 3天预报天气数据 | WeatherDailyResponse |
| weather7d | 7天预报天气数据 | WeatherDailyResponse |
| weather10d | 10天预报天气数据 | WeatherDailyResponse |
| weather15d | 15天预报天气数据 | WeatherDailyResponse |
| weather30d | 30天预报天气数据 | WeatherDailyResponse |
参数
WeatherParameter
-
location(必选)需要查询地区的LocationID或以英文逗号分隔的经度,纬度坐标(十进制,最多支持小数点后两位),LocationID可通过GeoAPI获取。例如location=101010100或location=116.41,39.92 -
lang多语言设置,请阅读多语言文档,了解我们的多语言是如何工作、如何设置以及数据是否支持多语言。 -
unit数据单位设置,可选值包括unit=m(公制单位,默认)和unit=i(英制单位)。更多选项和说明参考度量衡单位。
示例代码
WeatherParameter parameter = new WeatherParameter("101010100");
/**
* 获取3天预报数据
*/
public void weather3d(WeatherParameter parameter, Callback<WeatherDailyResponse> callback);
/**
* 获取7天预报数据
*/
public void weather7d(WeatherParameter parameter, Callback<WeatherDailyResponse> callback);
/**
* 获取10天预报数据
*/
public void weather10d(WeatherParameter parameter, Callback<WeatherDailyResponse> callback);
/**
* 获取15天预报数据
*/
public void weather15d(WeatherParameter parameter, Callback<WeatherDailyResponse> callback);
/**
* 获取30天预报数据
*/
public void weather30d(WeatherParameter parameter, Callback<WeatherDailyResponse> callback);
返回数据
WeatherDailyResponse
-
code请参考状态码 -
updateTime当前API的最近更新时间 -
fxLink当前数据的响应式页面,便于嵌入网站或应用 -
daily.fxDate预报日期 -
daily.sunrise日出时间,在高纬度地区可能为空 -
daily.sunset日落时间,在高纬度地区可能为空 -
daily.moonrise当天月升时间,可能为空 -
daily.moonset当天月落时间,可能为空 -
daily.moonPhase月相名称 -
daily.moonPhaseIcon月相图标代码,另请参考天气图标项目 -
daily.tempMax预报当天最高温度 -
daily.tempMin预报当天最低温度 -
daily.iconDay预报白天天气状况的图标代码,另请参考天气图标项目 -
daily.textDay预报白天天气状况文字描述,包括阴晴雨雪等天气状态的描述 -
daily.iconNight预报夜间天气状况的图标代码,另请参考天气图标项目 -
daily.textNight预报晚间天气状况文字描述,包括阴晴雨雪等天气状态的描述 -
daily.wind360Day预报白天风向360角度 -
daily.windDirDay预报白天风向 -
daily.windScaleDay预报白天风力等级 -
daily.windSpeedDay预报白天风速,公里/小时 -
daily.wind360Night预报夜间风向360角度 -
daily.windDirNight预报夜间当天风向 -
daily.windScaleNight预报夜间风力等级 -
daily.windSpeedNight预报夜间风速,公里/小时 -
daily.precip预报当天总降水量,默认单位:毫米 -
daily.uvIndex紫外线强度指数 -
daily.humidity相对湿度,百分比数值 -
daily.pressure大气压强,默认单位:百帕 -
daily.vis能见度,默认单位:公里 -
daily.cloud云量,百分比数值。可能为空 -
refer.sources原始数据来源,或数据源说明,可能为空 -
refer.license数据许可或版权声明,可能为空