1

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);
        }
    });
user2322082
  • 658
  • 1
  • 6
  • 18
  • 1
    Note for future readers: the weather snapshot only updates ~ every four hours, and does not appear to update if the location changes. Also the weather isn't very fine-grained. Basically don't trust it too much. – Turnsole Sep 09 '16 at 18:57

1 Answers1

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.

buddhabath
  • 664
  • 1
  • 10
  • 22
  • Hm. Today it can't retrieve the weather. Is it working for you today? – user2322082 Jul 05 '16 at 17:55
  • @user2322082 Every day between 8:45 - [13:00~14:00] GMT+2 (Sweden) the Awareness API Weather and Location gives me Timeout, so can't receive weather. Same for you? – buddhabath Jul 07 '16 at 07:45
  • That's when I'm asleep so I'm not sure if it works for me at those times. On Tuesday when I posted that comment I think it was timing out the whole day. It's probably safe to assume that this is all issues on Google's end, with awareness API still being pretty new. It's responding for me right now, and day by day the temperature has been changing, although I don't see it change very often. I still have yet to see it say anything but cloudy... I should have checked it last night when it was raining here. – user2322082 Jul 07 '16 at 12:27
  • @user2322082 I think so too. It is not responding for me right now, it was responding until about 8:45, then it stopped responding and started responding again at 12:45 or something, but since then only timeouts. (14:36 here now). Also I'm chasing another problem,my google play services crashes with GoogleApiClient must not be null, sometimes after I put the application in background and then take it to foreground again, like by sleeping the device. Have you had this problem? I made a thread about it http://stackoverflow.com/questions/38244651/googleapiclient-must-not-be-null-awareness-api – buddhabath Jul 07 '16 at 12:37
  • Interesting that it's working for me right now and not you. Maybe there's a lot of back-end steps in getting the weather and one of them is failing for your location and not mine. The response seems to be not changing though. I'll check it every 30 minutes today and tomorrow and track it to see how often it changes. Tomorrow it's supposed to thunderstorm almost all day, so I'll see what it says tomorrow and post an update on the situation for the weekend. As for your other problem, I haven't experienced that, and I'm not sure how to solve it. – user2322082 Jul 07 '16 at 12:57
  • @user2322082 I just re installed play services, and awareness started responding again (coincidence im pretty sure). It seems not to be crashing when awareness is responding, which is quite weird. I feel there might be some correlation caused by some flaw in the Awareness.API / GoogleApiClient. Now I feel rather certain that the error is not on my end – buddhabath Jul 07 '16 at 13:02
  • It just started giving TIMEOUT again, and Play Services Crash. :) – buddhabath Jul 07 '16 at 13:08
  • I've been tracking what it returns. Here's the timestamps and what it returned to me. Tomorrow it's supposed to rain all day so I'll track it tomorrow too. It appears to not update very often... http://pastebin.com/3QC61PjF – user2322082 Jul 07 '16 at 20:14
  • @user2322082 Do you still have trouble with the Weather services? It's been "response timed out" for me now for two days – buddhabath Aug 22 '16 at 06:42