I\'ve added GroundOverlay to map and want to limit scrolling and zooming within this area.
How to limit scrolling within some bounds on android google maps?
Instead of using new and shiny push technology which is onCameraChange
, you may try to use old poll technology: map.getCameraPosition()
or map.getProjection().getVisibleRegion()
. You can then check if returned value is what you like and if not, map.moveCamera(...)
.
Basically you need a Handler
, which will get the value of camera position in handleMessage
and you send messages to this handler every 10ms or so. Inside handleMessage
do sendEmptyMessageDelayed
.
You can also use Runnable
instead of Message
(but that's a matter of taste).