Aggregated data Development National Weather forecast query Android program

Source: Internet
Author: User
Tags openid

First, the project shows the following results:

Project Source code:
Http://yunpan.cn/cZVWIieuFyK9I Access Password 2EAC

second, using the Aggregation Data SDK:
(1) Aggregated data official website address: http://www.juhe.cn/

(2) Register your account-Create a new app (in the Personal Center page-Data Center-request data) – Fill in your application – Find categories – weather forecast – National Weather forecast

(3) Download the SDK (since the project uses 1-point versions, please download: Included in my project!) )
(4) Reference development document: Http://www.juhe.cn/juhesdk/adocs

This article describes the initialization of the aggregation data SDK and the use of permissions!

Iii. Introduction of the project

(1) Project

(2) Weatherapplication.java here as an initialization of the SDK

 PackageCom.juhe.weather;ImportCom.thinkland.juheapi.common.CommonFun;ImportAndroid.app.Application;/** * Here is the SDK to initialize aggregated data * * need to add android:name= in Application "com.juhe.weather.WeatherApplication * * @author Xu Liugen * * * * Public  class weatherapplication extends application {    @Override     Public void onCreate() {Super. OnCreate ();//Use the Aggregation SDK to initialize the processCommonfun.initialize (Getapplicationcontext ()); }}

We need to include the following in the manifest file:

android:name="com.juhe.weather.WeatherApplication"


(3) The JSON data format returned

{"ResultCode":" the","Reason":"successed!","Result": {"SK": {"Temp":"very","Wind_direction":"Northwest Wind","Wind_strength":"Level 1","Humidity":"37%","Time":"16:00"},"Today": {"Temperature":"5℃~19℃","Weather":"Very cloudy","weather_id": {"FA":" the","FB":" the"},"Wind":"Southerly Breeze","Week":"Friday","City":"Chengdu","Date_y":"March 13, 2015","Dressing_index":"Great Stay","Dressing_advice":"A thin coat, cardigan denim shirt pants and other garments are recommended. The frail and infirm should be suitably added clothing, suitable for jackets, thin sweaters and so on. ","Uv_index":"Weakest","Comfort_index":"","Wash_index":"Good for a short","Travel_index":"","Exercise_index":"Not recommended","Drying_index":""},"Future": {"day_20150313": {"Temperature":"5℃~19℃","Weather":"Very cloudy","weather_id": {"FA":" the","FB":" the"},"Wind":"Southerly Breeze","Week":"Friday","Date":"20150313"},"day_20150319": {"Temperature":"10℃~18℃","Weather":"Yin","weather_id": {"FA":" the","FB":" the"},"Wind":"Southerly Breeze","Week":"Thursday","Date":"20150319"}        }    },"Error_code":0The JSON data format for the next three days: {"ResultCode":" the","Reason":"successed!","Result": [{"Weatherid":" the","Weather":"Sunny","Temp1":"+","Temp2":"very","sh":" the","Eh":"a","Date":"20150313","Sfdate":"20150313170000","Efdate":"20150313200000"},    {"Weatherid":" the","Weather":"Yin","Temp1":"very","Temp2":"+","sh":"One","Eh":" the","Date":"20150320","Sfdate":"20150320110000","Efdate":"20150320170000"}],"Error_code":0}

(4) According to the above JSON format, we need to create the corresponding JSON question object, in order to better deal with, respectively, to establish the corresponding class


Is the JSON data containing the relationship, error-prone! Hereby mark it out!

(5) Weatherservice.java is mainly processing the background service class, the loading of data in the background!

Note that the following are:

The value of the white part here is the OpenID at the time of application on the aggregated data (in the center of the Personal Center home page can be found openid! )

Aggregated data Development National Weather forecast query Android program

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.