Cordova-plugin-googlemaps: How to install this plugin for Meteor cordova project?

Created on 19 Nov 2014  路  11Comments  路  Source: mapsplugin/cordova-plugin-googlemaps

Hello,

I need to add your plugin to a Meteor project, but "Meteor add cordova:..." doesn't accept a --variable parameter.
My idea was to manually add the ANDROID_API_KEY to the plugin.xml-file. But what do I need to change so the plugin doesn't expect a variable?

question

Most helpful comment

Actually there is an easier way.
You have to put this into the mobile-config.js file:

App.configurePlugin('plugin.google.maps', {
  'API_KEY_FOR_ANDROID': 'YOUR_API_KEY'
});

and then

meteor add cordova:[email protected]

And make sure the variable name 'API_KEY_FOR_ANDROID' is also in single quotation marks.

All 11 comments

Can you and the add the plugin without the variables ? If yes you could probably edit the plugin.xml to use the plugin.

Maybe a similar case: https://github.com/wf9a5m75/phonegap-googlemaps-plugin/wiki/Tutorial-for-Monaca

Thank you @TheMassassian :+1:

@der-ede
Some framework does not accept --variable parameter.
In this case, you can edit the plugin.xml with your text editor.

Download the phonegap-googlemaps-plugin.zip, then extract it.

And open the plugin.xml with your text editor,
remove two lines: <preference name="API_KEY_FOR_ANDROID" /> and <preference name="API_KEY_FOR_IOS" />,
then find and replace $API_KEY_FOR_ANDROID and $API_KEY_FOR_IOS with your API keys.

https://github.com/wf9a5m75/phonegap-googlemaps-plugin/wiki/Phonegap-Usage#5-install-this-plugin

Hi,

I know but Meteor also doesnt allow local installs, thats why I also posted
it on SO. So far I've tried to clone, change the plugin.xml, upload it to
my github acc. and then install it from there but for some reason it still
doesnt work.
Seems to be more of a Meteor problem. But thank you anyway.

I see, I've never used Meteor.
Is there any error log in logcat or Xcode?

Hi there, thank you for all the support.
The way I made it work is actually as described above.
Clone the plugin, put in the KEYS as described in the link Mr. Katsumata provided, then upload it to your own Github, and add to Meteor with:

meteor add cordova:plugin.google.maps@https://github.com/your_name/your_project_name/tarball/SHA1_HASH_ID

Thank you for sharing your knowledge :+1:

Actually there is an easier way.
You have to put this into the mobile-config.js file:

App.configurePlugin('plugin.google.maps', {
  'API_KEY_FOR_ANDROID': 'YOUR_API_KEY'
});

and then

meteor add cordova:[email protected]

And make sure the variable name 'API_KEY_FOR_ANDROID' is also in single quotation marks.

Nice :+1:

I wanted to post this for anybody looking to get this plugin working with meteor and crosswalk.

Crosswalk merged the fix to allow 'xwalkZOrderOnTop' preference being set, with this commit https://github.com/crosswalk-project/cordova-plugin-crosswalk-webview/commit/985d6f5518ca5223ad00fe1ad5da899c607b6105

So if you want to use cordova-plugin-googlemaps with meteor and crosswalk, you need to install crosswalk from at least that commit or newer.

Then add this to your mobile-config.js
App.setPreference('xwalkZOrderOnTop', true);

Also, I am using the latest commit of cordova-plugin-googlemaps.

Final thing is modifying the AndroidManifest.xml just as described in the crosswalk how to tutorial step #5..
https://github.com/mapsplugin/cordova-plugin-googlemaps/wiki/Tutorial-for-CrossWalk-Webview-Plugin-%28Android%29

Meteor doesn't replace the AndroidManifest.xml if it already exists so you can edit it (change "Black" to "Translucent") and rebuild and you should now be able to see the map finally! If anybody knows of a better, less hackish way to do this, that works with clean build, let me know please.

Oh, and if using ionic/meteoric, note the ionic fixes/workarounds listed under troubleshooting and tips. Essentially the side menus aren't made transparent by the map because they aren't part of parent node, so you have to figure a method to handle side menu visibility when using the map.

Good luck! The speed difference is huge and having this work with crosswalk was a deal breaker... now back to the less frustrating stuff :)

Yeah, I was on that commit inside of the comments :)
Thanks for the howto!

        <preference name="xwalkZOrderOnTop" value="true" />

Yeah Hirbod. I wouldn't have figured it out without all of your hard work. Thanks :)

Was this page helpful?
0 / 5 - 0 ratings