google-maps-services-java icon indicating copy to clipboard operation
google-maps-services-java copied to clipboard

Asynchronous calls in Google App Engine

Open engeeaitch opened this issue 9 years ago • 1 comments

When I try to run the following code (on Google App Engine):

    GeocodingApiRequest req = GeocodingApi.newRequest(context).address("Sydney");
    // Async
    req.setCallback(new GaePendingResult.Callback<GeocodingResult[]>() {
        @Override
        public void onResult(GeocodingResult[] result) {
            Log.info ("Location returned: "+result[0]);
            // Handle successful request.
        }

        @Override
        public void onFailure(Throwable e) {
            // Handle error.
        }
    });

I get the following error: Exception in thread "Thread-16" java.lang.RuntimeException: setCallback not implemented for Google App Engine

How do I make asynchronous calls in Google App Engine?

engeeaitch avatar Apr 30 '17 06:04 engeeaitch

Whups, I forgot that AppEngine for Java had stripped out the ability to create threads. You'll need to do synchronous requests in that environment.

domesticmouse avatar Jun 14 '17 04:06 domesticmouse