Closed 0xbs0d closed 7 years ago
Where do you have the GoogleMaps.load? Try displaying something to console or showing an alert just to make sure the API has been loaded:
GoogleMaps.ready('exampleMap', function() {
console.log("Load is ready); alert("API Ready"); });
I call it from Meteor.startup GoogleMaps.load Like I said it works great from meteor with the key in there. But when I build the application with meteor build I don't see any reference to this anymore. The map loads with an error because NoApiKey
Since last year, google require you to create a specific KEY for your app in order to use this API. You can do it here:
https://developers.google.com/maps/documentation/javascript/get-api-key#key
After obtaining your key, you must set it in your load function:
GoogleMaps.load({key: "myKeyHere"});
Yes, that's what I did
Meteor.startup(function() {
GoogleMaps.load({key: 'my_key'});
});
And like I said it works just fine. No errors or anything.
Until i build my app with meteor build. The resulted app has no reference of GoogleMaps.load OR my key. And if i run it i get the NoApiKey error and no map showing.
Ok, I see. Is your site a secure site? I think it should be. Check also if you are giving access to googleappis in your mobile-config.js
App.accessRule("maps.googleapis.com");
And build again. I'm not sure how do you know the GoogleMaps.load is not in your buid (in the case of an android APK)
It started working on it's own after I rebuilt the app. Tnx for the assistance @rubenlpz :+1:
I added the key as the documentation says and everything works fine when I just run the app. But when I build the app and run it with node main.js it says again NoApiKeys and if I search the generated code I don't see GoogleMaps.load called anywhere. Does anyone have any idea what it might be?