Software Archive
Read-only legacy content
17061 Discussions

Google maps Crosswalk Android build

Gerald_C_
Beginner
1,220 Views

Hey everyone!

I'm having a problem with Google maps with my App, basically when I run the app on the emulator the map works fine, when I run it on the Intel XDK app preview the map works fine, but when I build the app to a crosswalk android app, I get an empty panel and no map.

I have whitelisted the domain http://maps.google.com in my build settings but still see no map...

My HTML code is:
<div class="upage vertical-col left panel" data-nav="nav_side" id="map_canvas" data-header="map_header" data-load="loadFinder" data-footer="none" style="width:320px;height:100%;min-height:100%;text-align:center;">
                <h1>Determining Your Location</h1>
 </div>

And I just load the map with the simple JS code:

var mapOptions = {
        zoom:11,
        center: latlng,
        mapTypeId: google.maps.MapTypeId.ROADMAP,
        styles: lightMapStyle,
        zoomControl: true,
        zoomControlOptions: {
          style: google.maps.ZoomControlStyle.SMALL,
          position: google.maps.ControlPosition.LEFT_TOP
        },
    };
var _map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);

I'm not sure if I've missed something to do with the build settings...

Any help would be greatly appreciated!

Thanks!!

0 Kudos
6 Replies
Gerald_C_
Beginner
1,220 Views

Little update, my Google maps autocomplete input is not working either...

Hmmmm Sadly the Intel XDK debugger doesn't work on my phone so I could at least see what error is occuring....

0 Kudos
Chris_P_Intel
Employee
1,220 Views

I don't have a solution, but there is a Console widget in App Designer. It'll let you see any console.log messages right on your app, and you can also evaluate javascript there.  You might be able to use it to help debug your app.

0 Kudos
Gerald_C_
Beginner
1,220 Views

Thanks Chris, I'll give this a go but will this "Console widget" show up when I build the app to my device?

Because as I said before the Intel App preview works fine on my phone, it's only when I build the app and install it on my phone that the Google maps and Google Maps Autocomplete stop working... :(

0 Kudos
Gerald_C_
Beginner
1,220 Views

Could it be because don't have the googlemaps JS library locally?

i.e. I'm using this:

<script type="text/javascript" src="http://maps.google.com/maps/api/js?libraries=places&sensor=false"></script>

0 Kudos
Gerald_C_
Beginner
1,220 Views

So basically I found out I needed to whitelist more domains than just *.google.com

I got Google maps working now by whitelisting the following domains:

http://*.google.com
http://*.gstatic.com
http://*.googleapis.com
http://*.googleusercontent.com

Now for the last problem my Google maps autocomplete is still not working which I'm pretty sure once again I am missing a white listed domain will post something once I find out.

Hope this hopes anyone else as this is no where to be found in any Intel XDK documentation....

0 Kudos
Chris_P_Intel
Employee
1,220 Views

Thanks Gerald, and congratulations on figuring it out.

 

Yes, the console widget shows up on the device. That's what makes it handy. Obviously, not something you want to distribute in your final app, but it has proved itself useful from time to time. The best solution in these cases is the over-the-wire debugging that the XDK affords, and second best is the weinre debugging option.  But that little console widget can sometimes be handy.

0 Kudos
Reply