意识API总是返回多云天气 [英] Awareness API always returning cloudy weather

查看:104
本文介绍了意识API总是返回多云天气的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望能够在我的Android应用中查看天气.我实现了它,但它似乎总是在返回条件:[2]和其他任何东西,尽管事实上现在这里已经下了将近一个小时的雨.

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.

这里是返回的内容:

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

我正在Android v5.1上对此进行测试,可以在清单中找到正确的位置,然后在手机上将其打开.

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);
        }
    });

推荐答案

很抱歉得知您的天气糟糕. 除了笑话,这可能是局部降雨,而该地区通常是多云的,因为他们从某个来源获取天气数据,但那里可能没有下雨. (有时会在半径500m的区域内下雨,但周围始终是阳光.

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.

起初我也觉得有些奇怪,因为在我的整个测试过程中,它总是报告相同的温度.原来温度真的很稳定,而且条件对我来说还算不错,就是下雨了,大约15分钟后开始下雨在我的办公室外面.

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.

这篇关于意识API总是返回多云天气的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆