導航:首頁 > 操作系統 > android獲取天氣預報

android獲取天氣預報

發布時間:2024-12-30 00:09:52

android 如何實現獲取天氣預報信息

方法步驟(以安卓5.0為例)

一、打開GPS

九、提示

1.適時刷新天氣需要開啟GPS定位。

2.在沒有WIFI的地方刷新天氣需要消耗一定的流量,刷新頻率越高,消耗流量越多。

❷ 編一個android的簡單天氣預報程序大概要用到哪些類都是干什麼的可以簡單說一下么

就一個訪問URL介面返回天氣數指扒歲據的類即可。 + xml 或者 json 數據此伏解析的類 + 一個主界面顯示的類。

第一個 url,可以使用中央氣象台的免費天氣api,或者yahoo的免費唯睜天氣 api,獲得xml天氣數據,或者json天氣數據。

第二個解析類,分別對xml數據或者json數據進行提取有用的天氣數據。

第三個類,負責將這處理後的數據顯示出來。

❸ Android上的天氣預報軟體哪個准一點呀 謝謝

單以預報准確而言,個人最為推薦墨跡天氣。一直在用,感覺很好。
1.墨跡天氣
墨跡天氣是一款以預報准確,覆蓋城市廣,流量少,界面華麗等為特點的桌面天氣軟體。
(支持語音播報天氣,皮膚資源也非常豐富!)

另外還有幾款好的軟體,各有所長吧。
2.GO天氣
GO天氣是一款華麗炫酷的實時天氣預報軟體,可查看全球主要城市的天氣。通過訪問美國及全世界數萬個地區中的最大的專業天氣網,GO天氣在任何時間任何地點,都可以獲得最精確的天氣信息。(Go團隊出品,支持高清天氣視頻,十分華麗!)
3.MIUI天氣
一款MIUI開發的天氣軟體,界面時尚大方美觀,功能強大,支持全國城市,支持周邊城市天氣預報,支持天氣提醒,支持污染指數等功能。
(提取自MIUI固件,高清皮膚,天氣效果動態顯示,給你最華麗的體驗!)
4.天氣通
天氣通是一款免費手機天氣預報軟體。通過網路獲取天氣信息,以直觀的圖文方式顯示,詳盡的城市目錄,支持多個預報網站。桌面圖標典雅,天氣網標則充滿新意。
(功能全面,支持全屏動畫,還有獨特的日歷備注功能!)
5.華麗動態天氣
Animated Weather是Android手機上的天氣預報應用程序,每日動態天氣預報,逼真的動態天氣特效,自定義背景,支持世界超過50000個城市的天氣預報。
(可自定義背景,支持城市全面!)

希望對你有幫助。

❹ Android系統天氣預報插件怎麼設置到桌面

如果是htc的話,長按天氣預報拖到桌面上,或者桌面右下角「+」插入「窗口小部件」下翻就有天氣了。

❺ 如何在android實現調用網上的天氣預報

下個GO天氣,在桌面選項里有小插件,放到桌面開啟自動更新就可以了。

❻ 手機是聯通的Android系統,有沒有天氣預報方面的軟體

天氣預報方面的軟體有很多,天氣秀、天氣通等,Android系統的手機(包含聯通定製機)推薦使用「墨跡天氣」。
墨跡天氣是一款桌面天氣軟體,預報准確,覆蓋城市廣,流量少,界面華麗。下載「墨跡天氣」軟體信息費完全免費,流量費由運營商收取。
聯通定製手機可以通過http://wap.mojichina.com下載。

❼ android端免費獲取天氣信息的伺服器介面有么

中國國家氣象局提供了獲取所在城市天氣預報信息介面。通過這個介面,我們就可以獲取天氣信息了。

關於獲取天氣預報的實例參考android學習手冊,裡面有源碼。android學習手冊包含9個章節,108個例子,源碼文檔隨便看,例子都是可交互,可運行,源碼採用android studio目錄結構,高亮顯示代碼,文檔都採用文檔結構圖顯示,可以快速定位。360手機助手中下載,圖標上有貝殼

中國國家氣象局天氣預報介面總共提供了三個:


http://www.weather.com.cn/data/sk/101010100.html

http://www.weather.com.cn/data/cityinfo/101010100.html

http://m.weather.com.cn/data/101010100.html

註:上面介面2014.3.4日已不再更新。換成這個:http://m.weather.com.cn/atad/101230201.html。各位看34樓。在此感謝tdwll和黃曉佳cobish。

最詳細的信息來自第三個介面。上面url中的101010100是城市代碼,這里是北京的城市代碼。只需要改變城市代碼,就可以得到所在城市的天氣信息。筆者在福州,所以選擇的城市代碼是福州101230101。

在瀏覽器上輸入url:http://m.weather.com.cn/data/101230101.html得到信息,天氣信息是json的數據格式,數據如下:

{"weatherinfo":{"city":"福州","city_en":"fuzhou","date_y":"2012年5月14日","date":"","week":"星期一","fchh":"08","cityid":"101230101","temp1":"29℃~23℃","temp2":"26℃~20℃","temp3":"24℃~20℃","temp4":"25℃~20℃","temp5":"24℃~21℃","temp6":"25℃~22℃","tempF1":"84.2℉~73.4℉","tempF2":"78.8℉~68℉","tempF3":"75.2℉~68℉","tempF4":"77℉~68℉","tempF5":"75.2℉~69.8℉","tempF6":"77℉~71.6℉","weather1":"陣雨轉中雨","weather2":"中雨轉小雨","weather3":"小雨","weather4":"小雨","weather5":"小雨轉陣雨","weather6":"陣雨轉小雨","img1":"3","img2":"8","img3":"8","img4":"7","img5":"7","img6":"99","img7":"7","img8":"99","img9":"7","img10":"3","img11":"3","img12":"7","img_single":"3","img_title1":"陣雨","img_title2":"中雨","img_title3":"中雨","img_title4":"小雨","img_title5":"小雨","img_title6":"小雨","img_title7":"小雨","img_title8":"小雨","img_title9":"小雨","img_title10":"陣雨","img_title11":"陣雨","img_title12":"小雨","img_title_single":"陣雨","wind1":"微風","wind2":"微風","wind3":"微風","wind4":"微風","wind5":"微風","wind6":"微風","fx1":"微風","fx2":"微風","fl1":"小於3級","fl2":"小於3級","fl3":"小於3級","fl4":"小於3級","fl5":"小於3級","fl6":"小於3級","index":"熱","index_d":"天氣較熱,建議著短裙、短褲、短套裝、T恤等夏季服裝。年老體弱者宜著長袖襯衫和單褲。","index48":"暖","index48_d":"較涼爽,建議著長袖襯衫加單褲等春秋過渡裝。年老體弱者宜著針織長袖襯衫、馬甲和長褲。","index_uv":"弱","index48_uv":"最弱","index_xc":"不宜","index_tr":"適宜","index_co":"較不舒適","st1":"27","st2":"21","st3":"24","st4":"18","st5":"22","st6":"18","index_cl":"較不宜","index_ls":"不太適宜","index_ag":"不易發"}}


我們可以解析json數據去得到自己想用的天氣信息。


天氣信息解釋:


[html] view plain print?

{

"weatherinfo":{

<!--基本信息-->

"city":"福州",

"city_en":"fuzhou",

"date_y":"2012年5月14日",

"date":"",

"week":"星期一",

"fchh":"08",

"cityid":"101230101",

<!--從今天開始到第六天的每天的天氣情況,這里的溫度是攝氏溫度-->

"temp1":"29℃~23℃","temp2":"26℃~20℃","temp3":"24℃~20℃","temp4":"25℃~20℃","temp5":"24℃~21℃","temp6":"25℃~22℃",

<!--從今天開始到第六天的每天的天氣情況,這里的溫度是華氏溫度-->

"tempF1":"84.2℉~73.4℉","tempF2":"78.8℉~68℉","tempF3":"75.2℉~68℉","tempF4":"77℉~68℉","tempF5":"75.2℉~69.8℉","tempF6":"77℉~71.6℉",

<!--天氣描述-->

"weather1":"陣雨轉中雨","weather2":"中雨轉小雨","weather3":"小雨","weather4":"小雨","weather5":"小雨轉陣雨","weather6":"陣雨轉小雨",

<!--天氣描述圖片序號-->

"img1":"3","img2":"8","img3":"8","img4":"7","img5":"7","img6":"99","img7":"7","img8":"99","img9":"7","img10":"3","img11":"3","img12":"7","img_single":"3",

<!--圖片名稱-->

"img_title1":"陣雨","img_title2":"中雨","img_title3":"中雨","img_title4":"小雨","img_title5":"小雨","img_title6":"小雨","img_title7":"小雨","img_title8":"小雨","img_title9":"小雨","img_title10":"陣雨","img_title11":"陣雨","img_title12":"小雨","img_title_single":"陣雨",

<!--風速描述-->

"wind1":"微風","wind2":"微風","wind3":"微風","wind4":"微風","wind5":"微風","wind6":"微風","fx1":"微風","fx2":"微風",

<!--風速級別描述-->

"fl1":"小於3級","fl2":"小於3級","fl3":"小於3級","fl4":"小於3級","fl5":"小於3級","fl6":"小於3級",

<!--今天穿衣指數-->

"index":"熱",

"index_d":"天氣較熱,建議著短裙、短褲、短套裝、T恤等夏季服裝。年老體弱者宜著長袖襯衫和單褲。",

<!--48小時穿衣指數-->

"index48":"暖","index48_d":"較涼爽,建議著長袖襯衫加單褲等春秋過渡裝。年老體弱者宜著針織長袖襯衫、馬甲和長褲。",

<!--紫外線及48小時紫外線-->

"index_uv":"弱","index48_uv":"最弱",

<!--洗車-->

"index_xc":"不宜",

<!--旅遊-->

"index_tr":"適宜",、

<!--舒適指數-->

"index_co":"較不舒適",

"st1":"27","st2":"21","st3":"24","st4":"18","st5":"22","st6":"18",

<!--晨練-->

"index_cl":"較不宜",

<!--晾曬-->

"index_ls":"不太適宜",

<!--過敏-->

"index_ag":"不易發"

}

}

{
"weatherinfo":{
<!-- 基本信息 -->
"city":"福州",
"city_en":"fuzhou",
"date_y":"2012年5月14日",
"date":"",
"week":"星期一",
"fchh":"08",
"cityid":"101230101",
<!-- 從今天開始到第六天的每天的天氣情況,這里的溫度是攝氏溫度 -->
"temp1":"29℃~23℃","temp2":"26℃~20℃","temp3":"24℃~20℃","temp4":"25℃~20℃","temp5":"24℃~21℃","temp6":"25℃~22℃",
<!-- 從今天開始到第六天的每天的天氣情況,這里的溫度是華氏溫度 -->
"tempF1":"84.2℉~73.4℉","tempF2":"78.8℉~68℉","tempF3":"75.2℉~68℉","tempF4":"77℉~68℉","tempF5":"75.2℉~69.8℉","tempF6":"77℉~71.6℉",
<!-- 天氣描述 -->
"weather1":"陣雨轉中雨","weather2":"中雨轉小雨","weather3":"小雨","weather4":"小雨","weather5":"小雨轉陣雨","weather6":"陣雨轉小雨",
<!-- 天氣描述圖片序號 -->
"img1":"3","img2":"8","img3":"8","img4":"7","img5":"7","img6":"99","img7":"7","img8":"99","img9":"7","img10":"3","img11":"3","img12":"7","img_single":"3",
<!-- 圖片名稱 -->
"img_title1":"陣雨","img_title2":"中雨","img_title3":"中雨","img_title4":"小雨","img_title5":"小雨","img_title6":"小雨","img_title7":"小雨","img_title8":"小雨","img_title9":"小雨","img_title10":"陣雨","img_title11":"陣雨","img_title12":"小雨","img_title_single":"陣雨",
<!-- 風速描述 -->
"wind1":"微風","wind2":"微風","wind3":"微風","wind4":"微風","wind5":"微風","wind6":"微風","fx1":"微風","fx2":"微風",
<!-- 風速級別描述 -->
"fl1":"小於3級","fl2":"小於3級","fl3":"小於3級","fl4":"小於3級","fl5":"小於3級","fl6":"小於3級",
<!-- 今天穿衣指數 -->
"index":"熱",
"index_d":"天氣較熱,建議著短裙、短褲、短套裝、T恤等夏季服裝。年老體弱者宜著長袖襯衫和單褲。",
<!-- 48小時穿衣指數 -->
"index48":"暖","index48_d":"較涼爽,建議著長袖襯衫加單褲等春秋過渡裝。年老體弱者宜著針織長袖襯衫、馬甲和長褲。",
<!-- 紫外線及48小時紫外線 -->
"index_uv":"弱","index48_uv":"最弱",
<!-- 洗車 -->
"index_xc":"不宜",
<!-- 旅遊 -->
"index_tr":"適宜",、
<!-- 舒適指數 -->
"index_co":"較不舒適",
"st1":"27","st2":"21","st3":"24","st4":"18","st5":"22","st6":"18",
<!-- 晨練 -->
"index_cl":"較不宜",
<!-- 晾曬 -->
"index_ls":"不太適宜",
<!-- 過敏 -->
"index_ag":"不易發"
}
}

閱讀全文

與android獲取天氣預報相關的資料

熱點內容
cng壓縮機回收罐 瀏覽:533
怪物獵人xx3ds安裝包解壓 瀏覽:596
無盡的拉格朗日怎麼轉伺服器 瀏覽:890
程序員為公司竊取用戶隱私自首 瀏覽:662
程序員西瓜包子 瀏覽:667
如何把手機的app傳上電視 瀏覽:126
如何能把app卸載干凈 瀏覽:78
怎麼看源碼是否反編譯的 瀏覽:577
方舟編譯器應用機型 瀏覽:614
最新代理伺服器地址大全 瀏覽:421
安卓和java前景 瀏覽:663
javanum 瀏覽:997
什麼app能把方邊照片裁成圓邊 瀏覽:344
虛擬伺服器埠映射什麼意思 瀏覽:446
思考的藝術pdf 瀏覽:815
保存在手機文件夾的文件怎麼找 瀏覽:158
長安cs15壓縮比 瀏覽:186
編程貓如何製作2d地圖 瀏覽:645
誠信相親交友app怎麼樣 瀏覽:919
小尼尋師app是干什麼的 瀏覽:39