[Google Maps Plugin] Google Maps Plugin Marker Event

[Google Maps Plugin] Google Maps Plugin Marker Event

  
Forge Component
(4)
Published on 2017-08-04 by Grazina
4 votes
Published on 2017-08-04 by Grazina


Hi, I'm trying to raise the marker event on Google Maps Plugin but haven't been able, searching I see this is posible in Google Maps, does someone has done this in the Google Maps Plugin.

Im working on a mobile app.

Regards.

I'm really new to OS, so have to ask.  How are you using the Google Maps Plugin in a mobile app?  I can add the Google Maps plugin as a dependency, but the UI Flows section is disabled.  This section includes the Map webblocks... and so I can't add a map to a mobile screen.

Why would you use the Google Maps Plugin instead of the Google Maps Mobile Plugin?

I'm interested in researching your post, but I'm having trouble with the plugin you're using.

Hi Davidk,

I'm really new to OS, so have to ask.  How are you using the Google Maps Plugin in a mobile app?  I can add the Google Maps plugin as a dependency, but the UI Flows section is disabled.  This section includes the Map webblocks... and so I can't add a map to a mobile screen.

Why would you use the Google Maps Plugin instead of the Google Maps Mobile Plugin?

I'm interested in researching your post, but I'm having trouble with the plugin you're using.

The Flow section is disabled because you need reference the Google Maps Plugin from a module of a mobile application, and you probably are referencing it from a module of a web application. I don't understand your distinction between "Google Maps Plugin" and "Google Maps Mobile Plugin". You meant "Google Maps Mobile", right? because that last one is also Mobile, so you shouldn't be able to reference it from web as well.

Hi, 

ccaceres, I have a version still in development that aims at handling marker events. It's quite simple in Javascript. You take the object that is returned from AddMarker and do this on a Javascript node after adding the marker:

theobject.on("MARKER_CLICK", function(){@YouScreenAction});

Where your screen action should receive a LatLng parameter (check documentation here)

However, as simple as this seems, this simple code does not consider unregistering events, for instance.

I'm considering having the event being thrown as an event of the Map block, like the other map related events that are already there.


Kind Regards,

João Grazina



Davidk wrote:

I'm really new to OS, so have to ask.  How are you using the Google Maps Plugin in a mobile app?  I can add the Google Maps plugin as a dependency, but the UI Flows section is disabled.  This section includes the Map webblocks... and so I can't add a map to a mobile screen.

Why would you use the Google Maps Plugin instead of the Google Maps Mobile Plugin?

I'm interested in researching your post, but I'm having trouble with the plugin you're using.

Hi Davik, there are two plugins for google map for mobile Apps, on is named "Google Maps Mobile" and the other one "Google Maps Plugin" both are for mobile I'm using the second one because it displays my current location when my device is moving and it has some camera movements that the first plugin doesn't have.


Grazina wrote:

Hi Davidk,

I'm really new to OS, so have to ask.  How are you using the Google Maps Plugin in a mobile app?  I can add the Google Maps plugin as a dependency, but the UI Flows section is disabled.  This section includes the Map webblocks... and so I can't add a map to a mobile screen.

Why would you use the Google Maps Plugin instead of the Google Maps Mobile Plugin?

I'm interested in researching your post, but I'm having trouble with the plugin you're using.

The Flow section is disabled because you need reference the Google Maps Plugin from a module of a mobile application, and you probably are referencing it from a module of a web application. I don't understand your distinction between "Google Maps Plugin" and "Google Maps Mobile Plugin". You meant "Google Maps Mobile", right? because that last one is also Mobile, so you shouldn't be able to reference it from web as well.

Hi, 

ccaceres, I have a version still in development that aims at handling marker events. It's quite simple in Javascript. You take the object that is returned from AddMarker and do this on a Javascript node after adding the marker:

theobject.on("MARKER_CLICK", function(){@YouScreenAction});

Where your screen action should receive a LatLng parameter (check documentation here)

However, as simple as this seems, this simple code does not consider unregistering events, for instance.

I'm considering having the event being thrown as an event of the Map block, like the other map related events that are already there.


Kind Regards,

João Grazina




Thanks Grazina, do you have an example of the Java Script?

I have the example that I wrote above... it's not much, I know. 

Basically, just pass the output paramter of AddMarker, called Marker, to a Javascript node. lets call the input of the Javascript node "markerObj". 

Then define an action that will process the MARKER_CLICK event in your page. Lets call it OnMarkerClicked. Add a LatLng input parameter.

Lastly, type this code inside the Javascript node:
$parameters.markerObj.on("MARKER_CLICK", $actions.OnMarkerClicked);

That's it. Let me just add this: I DID NOT TEST IT!! But let me know if it works! ;-)


João

Grazina wrote:

I have the example that I wrote above... it's not much, I know. 

Basically, just pass the output paramter of AddMarker, called Marker, to a Javascript node. lets call the input of the Javascript node "markerObj". 

Then define an action that will process the MARKER_CLICK event in your page. Lets call it OnMarkerClicked. Add a LatLng input parameter.

Lastly, type this code inside the Javascript node:
$parameters.markerObj.on("MARKER_CLICK", $actions.OnMarkerClicked);

That's it. Let me just add this: I DID NOT TEST IT!! But let me know if it works! ;-)


João


I followed all the steps and added the JavaScript just after I created the Marker:

I run the app and try to clic the marker but nothing happens, inside the action I only have a message to test if it works.

Thanks for the explanation... I knew I must be missing something.  I didn't know about that 3rd plugin.