4

I'm trying to use the Google Awareness API in my IoT Project, however, when calling the Weather and Location API I'm receiving TIMEOUT errors.

Gradle:

compile 'com.google.android.gms:play-services-awareness:11.0.4' provided 'com.google.android.things:androidthings:0.5.1-devpreview'

Manifest:

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

API Call:

Awareness.SnapshotApi.getWeather(mGoogleApiClient).setResultCallback(new ResultCallback<WeatherResult>() {

            @Override
            public void onResult(@NonNull WeatherResult weatherResult) {
                Log.d(TAG, "Weather result received: " + weatherResult.getStatus());
                Log.d(TAG, "Weather result code" + weatherResult.getStatus().getStatusCode());
                Log.d(TAG, "Weather result message" + weatherResult.getStatus().getStatusMessage());
                if (weatherResult.getStatus().isSuccess()) {
                    Weather weather = weatherResult.getWeather();
                    Log.d(TAG, "weather: " + weather);
                    int[] conditions = weather.getConditions();
                }
            }
        });

Logcat:

09-28 16:10:37.557 3234-3234/com.iotunicamp.smartmirror D/DataProviderService: Weather result received: Status{statusCode=TIMEOUT, resolution=null} 09-28 16:10:37.558 3234-3234/com.iotunicamp.smartmirror D/DataProviderService: Weather result code 15 09-28 16:10:37.559 3234-3234/com.iotunicamp.smartmirror D/DataProviderService: Weather result message null

The same code works fine in the Android device.

PS: The internet is working fine on my iot device, I have a code that download a file as part of the project and it works.

Do you have any idea of what's happening?

DaniloBertelli
  • 121
  • 1
  • 5

0 Answers0