Search code examples
google-mapsgoogle-maps-api-3meteor

google map not displaying on mobile


hello guys I am using meteor-google-map. I can see them on the desktop but on mobile I can't see them. Can anybody tell me what is it that I am doing wrong ?? on the mobile the map container is all blank. Here is an image

map not appearing

If I have to white list the domains then can somebody tell me that how would I white list the google map because from the documentation which is

tel:, geo:, mailto:, sms:, market:* are allowed and launch externally (phone app, or an email client on Android)

I think google map is allowed

here is the google map code

index.html

  <div class="map-container">
    {{> googleMap name="exampleMap" options=exampleMapOptions}}
  </div>

index.js

    exampleMapOptions: function() {
    // Make sure the maps API has loaded
    if (GoogleMaps.loaded()) {
      // Map initialization options
      return {
        center: new google.maps.LatLng(Meteor.user().profile.latitude, Meteor.user().profile.longitude),
        zoom: 13
      };
    }
  }

Template.body.onCreated(function() {
  // We can use the `ready` callback to interact with the map API once the map is ready.
  GoogleMaps.ready('exampleMap', function(map) {
    // Add a marker to the map once it's ready
    var marker = new google.maps.Marker({
      position: map.options.center,
      map: map.instance
    });
  });
});

UPDATE

I found out I was getting the error uncaught referenceerror: google is not defined

so I tried white listing but it is not working

> App.info({   id: 'com.example.matt.uber',   
>name: 'MedCircle',  
> description: 'Get über power in one button click',   
>author: 'Matt
> Development Group',   
>email: '[email protected]',   
>website: 'http://example.com' 
>}); 
> 
> App.setPreference('BackgroundColor', '0xff0000ff');
> App.setPreference('HideKeyboardFormAccessoryBar', true);
> App.setPreference('Orientation', 'default');
> 
> 
> // App.accessRule('*.googleapis.com'); 
> //App.accessRule('*.gstatic.com'); 
>// App.accessRule('*.google.com'); //
>// App.accessRule('maps.googleapis.com'); 
>// App.accessRule('maps.gstatic.com'); 
>// App.accessRule('mt0.googleapis.com'); 
>// App.accessRule('mt1.googleapis.com'); 
>// App.accessRule('csi.gstatic.com');
> 
> 
> // <access origin="*://*.googleapis.com/*" subdomains="true" /> 
> //<access origin="*://*.gstatic.com/*" subdomains="true" /> 
> // <accessorigin="*://*.google.com/*" subdomains="true" /> 
> // <accessorigin="*://*.googleusercontent.com/*" subdomains="true" />
> 
> App.accessRule('*');

Solution

  • I figured it out I had to allow these to

    App.accessRule('http://*');
    App.accessRule('https://*');