udacity / Sunshine-Version-2

The official repository for Developing Android Apps
Apache License 2.0
2.87k stars 4.41k forks source link

how to provide auto complete list of city or postal code ? #229

Open hetaldadhaniya12 opened 8 years ago

hetaldadhaniya12 commented 8 years ago

Hi,

i am trying to get data of Hawthorn,Australia. so I have passed postal code 3122. but it gives weather data of Gemeente Schiedam,NL. but when i have passed parameter like this 3122,au.it gives perfect result. 1)so how can i pass this kind of parameter q="{postalcode}{country}" in code? 2)why this two urls give different data?

http://api.openweathermap.org/data/2.5/forecast/daily?q=3122&mode=json&units=metric&cnt=7&appid=your app id

http://api.openweathermap.org/data/2.5/forecast/daily?q=3122,au&mode=json&units=metric&cnt=7&appid=your app id

Pass your Preferred Appid.

mathemandy commented 8 years ago

Answering Question 2.

according to Openweather map http://openweathermap.org/current#name ss3 , you are expected to call a particular city by its city id to get unambiguous result

mathemandy commented 8 years ago

For Question 1 Just pass the value to a string.

So i declare my Location String Here as pref_location_default.... ss 4

and use it here

ss 5

hetaldadhaniya12 commented 8 years ago

hi Andy, Thank you for replay. but every user does not know city Id so our app will not be user friendly.

How can we pass auto complete list of city or postal code ? because one city is located in many other country .

for example. if i pass hawthorn ,it showing me US hawthorn weather data,but i actually want AU hawthorn weather data. so it is better to give auto complete list to user where they can select which ever they want.

img_3322

img_3323

Thank you in advace.

Regards,

Hetal Patel

On Fri, Jun 3, 2016 at 9:18 AM, Andy Eshiet notifications@github.com wrote:

For Question 1 Just pass the value to a string.

So i declare my Location String Here as pref_location_default.... [image: ss 4] https://cloud.githubusercontent.com/assets/6526607/15764108/575ee2f4-2920-11e6-9c7e-a65e2b82f1d1.PNG

and use it here

[image: ss 5] https://cloud.githubusercontent.com/assets/6526607/15764126/748ff30e-2920-11e6-8d7d-cd84e9150627.PNG

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/udacity/Sunshine-Version-2/issues/229#issuecomment-223450628, or mute the thread https://github.com/notifications/unsubscribe/ASe2JsHbUuEgdjnSN35C0l_csFZ0thfyks5qH2SogaJpZM4IqFir .