Awareness API always returning cloudy weather

喜夏-厌秋 提交于 2019-12-11 04:41:25

问题


I want to be able to check the weather in my Android app. I implemented it, but it seems to always be returning conditions: [2] and nothing else, despite the fact it has been raining for almost an hour now here.

Here's what it's returning:

Temp=67.0F/19.444445C, Feels=67.0F/19.444445C, Dew=58.0F/14.444445C, Humidity=71, Condition=[2]

I'm testing this on Android v5.1 and yes fine location is in my manifest and turned on on my phone.

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>

Here's my code for getting the weather:

Awareness.SnapshotApi.getWeather(mGoogleApiClient)
    .setResultCallback(new ResultCallback<WeatherResult>() {
        @Override
        public void onResult(@NonNull WeatherResult weatherResult) {
            if (!weatherResult.getStatus().isSuccess()) {
                System.out.println("error: /*- could not get weather");
                return;
            }
            weather = weatherResult.getWeather();
            System.out.println("weather: " + weather);
        }
    });

回答1:


Sorry to hear that your weather is terrible. Jokes aside, it might be a very local rainfall, while it is generally cloudy in the region since they get their weather data from some source, it might not be raining there. (Sometimes it rains in a 500m radius zone, but is sunshine all around it.

I thought something was weird as well at first, because it always reported the same temperature throughout my testing. Turned out the temperature just had been really stable, and the conditions worked fine for me, it called rain and some 15 minutes later it started raining outside my office.



来源:https://stackoverflow.com/questions/38146933/awareness-api-always-returning-cloudy-weather

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!