I'm working on Android with the Google Places API
.
I'm having problems when running the PlaceDetectionApi's getCurrentPlace-method. The PlaceLikelihoodBuffer
I get in the resultcallback
of the method is empty, when I print the errorstatus
in my logcat, it say's the errorcodenumber is 13 and in the logcat, I can also read the line "D/PlaceInferenceEngine: No place inference engine is running, returning null"
.
I'm running this in an AVD on my emulator, unfortunately I can't test it on a real device in the moment.
So, the question is: what is this place inference engine and how can I get it running on my AVD?
The relevant piece of code is this:
public void getCurrentPosition(int requestCode) {
if(ContextCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) !=
PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this, new String[]{android.Manifest.permission.ACCESS_FINE_LOCATION},
requestCode);
} else {
if(requestCode == PERMISSION_REQUEST_GET_CURRENT_POSITION) {
PendingResult<PlaceLikelihoodBuffer> result = Places.PlaceDetectionApi.getCurrentPlace(client, new PlaceFilter());
result.setResultCallback(new ResultCallback<PlaceLikelihoodBuffer>() {
@Override
public void onResult(PlaceLikelihoodBuffer placeLikelihoods) {
System.out.println("inside callback...");
Status status = placeLikelihoods.getStatus();
System.out.println(status.isSuccess());
System.out.println(status.getStatusCode());
System.out.println(status.getStatusMessage());
for (PlaceLikelihood placeLikelihood : placeLikelihoods) {
Place place = placeLikelihood.getPlace();
System.out.println("possible place: " + place.getAddress());
}
placeLikelihoods.release();
}
});
}
}
}
The result in my logcat is:
06-19 14:39:33.436 1865-2848/com.google.android.gms.persistent D/PlaceInferenceEngine: No place inference engine is running, returning null
06-19 14:39:33.437 1865-2284/com.google.android.gms.persistent W/Places: getLastLocation returned null. Falling back to location updates
06-19 14:39:33.621 1865-2148/com.google.android.gms.persistent W/GCoreFlp: No location to return for getLastLocation()
06-19 14:39:43.478 1865-2284/com.google.android.gms.persistent E/Places: Timed out waiting for a location for getCurrentPlace
06-19 14:39:43.500 2760-2760/com.example.kevin.mapproject I/System.out: inside callback...
06-19 14:39:43.500 2760-2760/com.example.kevin.mapproject I/System.out: false
06-19 14:39:43.500 2760-2760/com.example.kevin.mapproject I/System.out: 13
06-19 14:39:43.500 2760-2760/com.example.kevin.mapproject I/System.out: ERROR