AnsweredAssumed Answered

Cordova plugin - google maps

Question asked by Michał Nowacki on Nov 29, 2017

I am trying to render a Google Map using a native view. According to the documentation (https://support.sugarcrm.com/Documentation/Mobile_Solutions/Mobile_SDK/Mobile_SDK_Quick_Start_Guide/#Integrating_a_Cordova_Plugin), this should be a straightforward process.

Steps to reproduce the problem:

  1. Create new app using SugarCRM mobile SDK version 6.0.0.431-1.2.0-1

  2. Install cordova-plugin-googlemaps using command `../cordova plugins add cordova-plugin-googlemaps --variable API_KEY_FOR_ANDROID="..."` (I use API key that is not limited to any domain)

  3. Create new custom view based on the Nomad view

  4. In the template add a single div with id `map_canvas`, set `height` and `width` to `400px`

  5. In `onAfterRender` event handler initialize map using this code:
    var div = document.getElementById("map_canvas");
    map = plugin.google.maps.Map.getMap(div);

  6. Build android app using debug scheme: `./sdk build -p android`

  7. Run created application on real device or in AVD;

  8. Navigate to the newly created view;

  9. Nothing happens.

 

What I already know:

  1. API key is correct, I created a pure Cordova app, I added the same view (single div, and initialization fired upon ready) and it works as expected.

  2. Plugin is installed correctly, example from https://github.com/mapsplugin/cordova-plugin-googlemaps-doc/blob/master/v2.0.0/class/Environment/getLicenseInfo/README.md works correctly

 

Could you help me?

Outcomes