I want to make a marker on a Google Map on a specific place, the only information that I have is it's Google Places ID.
Retrieving the necessary information could be achieved with the command getPlaceById()
according to developers.google.com but that doesn't seem to work for me.
This is the code I use to request the place
private void addMarkerById(String id){
android.util.Log.d("MAP", "Finding place for " + id);
Places.GeoDataApi.getPlaceById(mClient, id) .setResultCallback(new ResultCallback<PlaceBuffer>() {
@Override
public void onResult(@NonNull PlaceBuffer places) {
if (places.getStatus().isSuccess() && places.getCount() > 0) {
Place place = places.get(0);
mMap.addMarker(new MarkerOptions().position(place.getLatLng()).title(place.getName().toString()));
}
places.release();
}
});
}
The map itself works fine and manually adding LatLng
also works.
The problem is probably with onResult
which doesn't seem to run at all.
The logs
05-17 19:51:52.940 2358-2358/? I/art: Not late-enabling -Xcheck:jni (already on)
05-17 19:51:52.940 2358-2358/? W/art: Unexpected CPU variant for X86 using defaults: x86
05-17 19:51:53.404 2358-2358/be.gillescoeman.scubajournal W/System: ClassLoader referenced unknown path: /data/app/be.gillescoeman.scubajournal-1/lib/x86
05-17 19:51:53.430 2358-2358/be.gillescoeman.scubajournal I/FirebaseInitProvider: FirebaseApp initialization unsuccessful
05-17 19:51:53.431 2358-2358/be.gillescoeman.scubajournal I/InstantRun: starting instant run server: is main process
05-17 19:51:53.556 2358-2358/be.gillescoeman.scubajournal I/zzai: Making Creator dynamically
05-17 19:51:53.559 2358-2358/be.gillescoeman.scubajournal W/System: ClassLoader referenced unknown path: /system/priv-app/PrebuiltGmsCore/lib/x86
05-17 19:51:53.560 2358-2358/be.gillescoeman.scubajournal D/ApplicationLoaders: ignored Vulkan layer search path /system/priv-app/PrebuiltGmsCore/lib/x86:/system/fake-libs:/system/priv-app/PrebuiltGmsCore/PrebuiltGmsCore.apk!/lib/x86:/system/lib:/vendor/lib for namespace 0xb3ace090
05-17 19:51:53.769 2358-2358/be.gillescoeman.scubajournal W/System: ClassLoader referenced unknown path:
05-17 19:51:53.770 2358-2358/be.gillescoeman.scubajournal W/System: ClassLoader referenced unknown path: /system/priv-app/PrebuiltGmsCore/lib/x86
05-17 19:51:53.770 2358-2358/be.gillescoeman.scubajournal D/ApplicationLoaders: ignored Vulkan layer search path /system/priv-app/PrebuiltGmsCore/lib/x86:/system/fake-libs:/system/priv-app/PrebuiltGmsCore/PrebuiltGmsCore.apk!/lib/x86:/system/lib:/vendor/lib for namespace 0xb3ace0d0
05-17 19:51:53.872 2358-2358/be.gillescoeman.scubajournal W/System: ClassLoader referenced unknown path: /data/user_de/0/com.google.android.gms/app_chimera/m/00000002/n/x86
05-17 19:51:54.008 2358-2358/be.gillescoeman.scubajournal I/Google Maps Android API: Google Play services client version: 10240000
05-17 19:51:54.068 2358-2358/be.gillescoeman.scubajournal I/Google Maps Android API: Google Play services package version: 10298470
05-17 19:51:54.290 2358-2428/be.gillescoeman.scubajournal D/NetworkSecurityConfig: No Network Security Config specified, using platform default
05-17 19:51:54.437 2358-2358/be.gillescoeman.scubajournal D/MAP: Locations Executed
05-17 19:51:54.485 2358-2358/be.gillescoeman.scubajournal D/MAP: Finding place for ChIJ5zmn4oo4w0cRUGpTw9AkU0A
[ 05-17 19:51:54.512 2358: 2469 D/ ]
HostConnection::get() New Host Connection established 0xa41c5580, tid 2469
05-17 19:51:54.514 2358-2469/be.gillescoeman.scubajournal I/OpenGLRenderer: Initialized EGL, version 1.4
05-17 19:51:54.514 2358-2469/be.gillescoeman.scubajournal D/OpenGLRenderer: Swap behavior 1
05-17 19:51:54.514 2358-2469/be.gillescoeman.scubajournal W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
05-17 19:51:54.514 2358-2469/be.gillescoeman.scubajournal D/OpenGLRenderer: Swap behavior 0
05-17 19:51:55.077 2358-2365/be.gillescoeman.scubajournal W/art: Suspending all threads took: 21.665ms
05-17 19:51:56.408 2358-2462/be.gillescoeman.scubajournal W/DynamiteModule: Local module descriptor class for com.google.android.gms.googlecertificates not found.
05-17 19:51:56.416 2358-2462/be.gillescoeman.scubajournal I/DynamiteModule: Considering local module com.google.android.gms.googlecertificates:0 and remote module com.google.android.gms.googlecertificates:2
05-17 19:51:56.416 2358-2462/be.gillescoeman.scubajournal I/DynamiteModule: Selected remote version of com.google.android.gms.googlecertificates, version >= 2