Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Zoom Move Pinch listener in google maps v2 in android

i'm using the maps v2 in my Android APP

My map is automatically updated every few seconds to show some new points on the map. For every time it refresh, automatically the following event: "setOnCameraChangeListener" is called.

The user can interact with the map by moving the camera or doing the Zoom. I need to intercept the user's gesture on the map such as "Zoom", "Drag", the "Pinch Open" or "Pinch Close".

So I can not use the "OnCameraChangeListener" because this is already done automatically from application when it auto update the data, and I am not able to understand when the event occurs for an automatic update of the map or when by user interaction

How do I trap these this user gesture?

like image 664
user2381742 Avatar asked Dec 17 '25 17:12

user2381742


1 Answers

automatically the following event: "setOnCameraChangeListener" is called.

Nothing is done automatically.

updated every few seconds to show some new points on the map.

and:

Then readjust the Zoom to fit the actual Marker on the map.

This seems like a very bad user experience: forcing user to look at your marker when they just want to swipe to Africa.

Anyway, if you have GoogleMap.animateCamera call in your code, you may use CancelableCallback parameter to help you distinguish between user activity and code call resulting in onCameraChange. See this comment on gmaps-api-issues for how to achieve this.

like image 168
MaciejGórski Avatar answered Dec 19 '25 08:12

MaciejGórski



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!