Let's follow up this discussion at the Neptune Community

(this forum will be kept in read-only mode)
Solved

Google Maps Markers

Hi All

I followed the neptune tutorial for google map markers and everything works well in the browser, but when I send it to the neptune client on my iphone the maps do not show.


I can open the app successfully in safari on my iphone by using the url.


I created the phonegap build, I have selected all options in plugins and permisions tabs for the bundle app.


I also tried this in chrome, no security by running the index.html file, I get the following error...

Uncaught ReferenceError: google is not defined


Any thoughts ?


Thanks


Darren


Hi Darren


The difference is how to load google API in a mobile device. You can try this example, loading google API for hybrid apps


   

var directionsDisplay;
var directionsService;
var map;

function loadScript() {
  var script = document.createElement("script");
  script.type = "text/javascript";
  script.src = "http://maps.googleapis.com/maps/api/js?key=AIzaSyClGtQTLN9rj__p_2S-HTZ9fAcjC3a22w8&sensor=true&callback=initialize";
  document.body.appendChild(script);
}

function initialize() {
  directionsDisplay = new google.maps.DirectionsRenderer();
  directionsService = new google.maps.DirectionsService();

  var mapOptions = {
  zoom: 6,
  mapTypeId: google.maps.MapTypeId.ROADMAP
};

 map = new google.maps.Map(document.getElementById("google-map"), mapOptions);
 directionsDisplay.setMap(map);

}

loadScript();

   

Thank you Ole-André, this worked perfectly.


I just put the loadScript function into my initialisation code, and all working now.


Thanks again.

Hi Darren,


I am looking for Google maps tutorial for Neptune but unable to find it. Can you please share the link?


Kind regards,

Amit

Hi Ole Andre,


Thanks for your quick reply. Unfortunately, I cannot access the link. I get the following error:

"You are not allowed to access this page!"


Can you please tell me how to enable access or send me a pdf copy? 


Thanks,

Amit

Thank you so much!

Hi Ole Andre,


I am just not able to make this example work. I did everything like in the tutorial and do not see any errors on debugging the application. I can confirm that the ajax call works correctly as the debugger stops in SAP class.

The only thing I am not sure of is if the google API is getting called correctly or not. How can i check that? I see that the variable 'map' in chrome debugger does get created.

Please help.


Thanks

Amit

Hi Amit


I found it better to place a sample on our Explored. Check it out and it will be a lot more easy


https://template.neptune-software.com/neptune/sdk/explored - And go to samples and search for "Google Maps". Then you can view in Web Designer or Run it.


Example

https://template.neptune-software.com/neptune/sdk/exp_sample_google_markers.html?sap-client=800


Regards

Ole Andre 



Hi Ole Andre,


It finally works for me.


Thanks a lot.


Amit

Login or Signup to post a comment