I've got an Android app with about 500-1000 markers. I am using the ClusterManager from the android-maps-utils as shown here to cluster these markers.
In the latest Play Services update Google changed the listener model of the Google Map. The OnCameraChangeListener
is marked as deprecated now. Instead there are four new listeners (OnCameraIdleListener, OnCameraMoveListener, OnCameraMoveStartedListener
,OnCameraMoveCanceledListener
).
Since that update my app is incredibly slow. It stucks on moving/zooming the map, the clustering process is laggy and needs some seconds.
I thought this behavior is maybe linked to the changes in the listener model. Therefore I tried to replace the addOnCameraChangeListener(clustermanager)
function with the new addOnCameraIdleListener(clustermanager)
. Unfortunately this is not working as the ClusterManager
does not implement the necessary Interface.
And this is where it gets strange, because the current version (0.4.3) of the ClusterManager
on GitHub does implement that Interface. So it should work.
I'm importing the ClusterManager using Gradle:
compile 'com.google.maps.android:android-maps-utils:0.4.3
but my local version of the ClusterManager
still seems to be an old one which implements the old OnCameraChangeListener
.
So what is wrong here? Is this a misbehavior of Gradle? Has anybody an idea how to fix this issue? And is there anybody else whose Google Map / Clusterer is slow and laggy since the last Play Services update?
I appreciate any help. Thanks, guys.
You need to use gooleMap.setOnCameraIdleListener(mClusterManager); instead of googleMap.setOnCameraMoveListener(mClusterManager);
You can to search for the source code of ClusterManager and you will see that ClusterManager implements the new OnCameraIdleListener.
Also you need to update to new android-maps-utils:0.4.4 (compile 'com.google.maps.android:android-maps-utils:0.4.4')
Good luck and vote up... ;-)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With