WeatherLib icon indicating copy to clipboard operation
WeatherLib copied to clipboard

I can't get searchCity list

Open GLodi opened this issue 9 years ago • 9 comments

Not sure if I set it right, but I understand from the documentation (http://survivingwithandroid.github.io/WeatherLib/android_weatherlib_search_city.html) that I'm supposed to set as pattern the city name's string. It doesn't work for me though. The method onCityListRetrieved doesn't seem to be called when I pass the name of a city, and the cityList (where I'm supposed to get the IDs) is not even created. Can anyone link me an example?

GLodi avatar Dec 21 '15 09:12 GLodi

Update: onWeatherError in searchCity returns "JSONException: no value for list". How do I fix it?

GLodi avatar Dec 22 '15 09:12 GLodi

i will check,,,

survivingwithandroid avatar Dec 29 '15 08:12 survivingwithandroid

I have the same exact problem using both Yahoo provider and OpenWeatherMap provider. The list is returned with empty. Is there any specific regex that we should pass?

raffaeu avatar Jan 05 '16 16:01 raffaeu

I am also facing the same issue, any solutions ?

sarinsukumar avatar Apr 18 '16 08:04 sarinsukumar

No, at the moment the only way for me is to use the open weather provider, the others do not work, I think the APIs are not up to date with the project.

raffaeu avatar Apr 18 '16 08:04 raffaeu

Which provider are you using now ? I cant see open weather provider.

sarinsukumar avatar Apr 18 '16 08:04 sarinsukumar

@surinsukumar I use this one and it works but you need to register and create your own key

if(config == null){ config = new WeatherConfig(); config.maxResult = 10; config.numDays = 1; config.ApiKey = "your key goes here"; config.unitSystem = WeatherConfig.UNIT_SYSTEM.M; }

WeatherClient client = builder.attach(context) .provider(new OpenweathermapProviderType()) .httpClient(com.survivingwithandroid.weather.lib.client.okhttp.WeatherDefaultClient.class) .config(config) .build();

raffaeu avatar Apr 18 '16 08:04 raffaeu

Thank you raffaeu, Openweather map is working isnt it ?

sarinsukumar avatar Apr 18 '16 09:04 sarinsukumar

Thank you @raffaeu it is working perfect for me.

sarinsukumar avatar Apr 18 '16 09:04 sarinsukumar