Ionic-native googlemaps zoom_changed event

I’ve noticed that ionic-native googlemaps seems to be missing the zoom_changed event, if I try binding an on() to the map on the string “zoom_changed” nothing happens either, for example:

console.log("we have zoomed!");

Any thoughts?

Edit: aaaah, looks like I should be using GoogleMapsEvent.CAMERA_CHANGE, but it still doesn’t seem to do anything?

The answer is: => {console.log(data);});

which returns a CameraPosition object:

CameraPosition {zoom: 14.15488052368164, tilt: 0, target: Object, bearing: 0, hashCode: -1384107267…}

which you can then compare the zoom level number.

Do you know if there is an event for bounds_changed?

hmm, well, following the same principle apparently CameraPosition also returns a “target”… see here

So I don’t know if there is a way of forcing it to return latlngbounds that you could compare???

Just thinking out loud here…

Yes it returns lat and lng.But i need something like this:

(this is the sdk javascript way)

google.maps.event.addListener(map, "bounds_changed", function () {
       let bounds = map.getBounds();
       let NE = bounds.getNorthEast();
       let SW = bounds.getSouthWest();
       parameters.NELat =;
       parameters.NELng = NE.lng();
       parameters.SWLat =;
        parameters.SWLng = SW.lng();

I dont know if there is a way to force it in the native way the object says :
target?: LatLng | LatLngBounds | LatLng[];

so it can return a latlngBounds but i dont know how

Just trying to see if there’s any options, and unfortunately it’s not showing much, so I don’t know why the typescript specifies several types for “target”.

So if we follow the trail, we start in the ionic-native typescript which shows the getCameraPosition function being mapped here…

but notice no parameters :frowning: so what is that a property of? GoogleMap…

so if we hop, skip and jump over to the underlying plugin, I’m looking at android here just for example:

the only place where you might get a clue in the code also seems to show no parameters:

So, once again, we can see how the “map” object is of type GoogleMap in the java:

which is in this package:

So, carrying on on to the java reference documentation we find the object here, and inside that is the native getCameraPosition() which also offers no clues… even the accompanying documentation here appears to be doing an excellent chocolate fireguard impression :frowning:

In conclusion shrug :neutral_face:

1 Like

Thanks for your research it looks pretty convincent what you say, but it has to be someone who can get it works the bounds with native map :confused:

I found it . This method returns the bounds:

map.getVisibleRegion().then((data) => {

So I guess if you combine the camera change event with getting the visible region that will work for you? It’s not quite as elegant as just subscribing to the event, but should work…

1 Like

Anybody know how to detect and fire google native map boundChange event or is there a event to detect zoom change?

Now I am using CAMERA_MOVE_END to detect boundChange and using MAP_DRAG_END to detect map dragged, when zoom map is ok, it only fire the CAMERA_MOVE_END event, but when drag maps, it fire both event which I don’t want to , I only want to fire drag event.

Anyone knows how to do that, thanks in advance.

Second post of the topic (above) explains how to detect zoom change, is that any good to you?

Hi , thanks for your reply.

I know how to detect zoom change using ‘CARMER_MOVE_XXX’, my issue is I don’t want to fire this kinds of event when drag the map, because , when dragging the map, there is actually no zoom change.