0

I have been using my ClusterManager with setOnCameraChangeListener however I have now found that with the newest play services this method is now deprecated.

What is the correct way to now have my ClusterManager handling camera change events?

Having a look at: OnCameraChangeListener() is deprecated

I tried:

mGoogleMap.setOnCameraMoveListener(mClusterManager);

However I end up with and error:

setOnCameraMoveListener in GoogleMap cannot be applied to ClusterManager

Community
  • 1
  • 1
DevWithZachary
  • 3,357
  • 10
  • 46
  • 97

1 Answers1

0

Try to use the GoogleMap.OnCameraIdleListener(). It is also an alternative way for the deprecated GoogleMap.OnCameraChangeListener.

So use this

mGoogleMap.setOnCameraIdleListener(mClusterManager);

instead of

mGoogleMap.setOnCameraMoveListener(mClusterManager);

I also found this related SO question that says that in order to use OnCameraIdleListener, you need to update to new android-maps-utils:0.4.4 (compile 'com.google.maps.android:android-maps-utils:0.4.4').

For more information, check also this github.

Community
  • 1
  • 1
KENdi
  • 7,670
  • 2
  • 15
  • 27