google-maps-services-java
google-maps-services-java copied to clipboard
Asynchronous calls in Google App Engine
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?
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.