Software Archive
Read-only legacy content
17061 Discussions

Maps on Windows Phone 8.1

Ilker_O_
Beginner
414 Views

Hello,

I use Intel XDK's geolocation sample.I set all build settings and api key then deploy my phone.But when index.html run app crashed.

How can I set map?

 

0 Kudos
4 Replies
Elroy_A_Intel
Employee
414 Views

This seems to be a bug with Windows Phone and/or Google Maps. I recommend making sure you are using the latest version of google maps API script.

Consider trying some of these samples provided directly by Google Maps as well at https://developers.google.com/maps/documentation/javascript/examples/#basics.

Also, make sure you have the appropriate URLs if you are not using * (which allows your app to access all URLs) under the Project Tab > Build Settings > Whitelist.

0 Kudos
Ilker_O_
Beginner
414 Views

Hi Elroy

My code is

<html>
    <head>

        <script type="text/javascript" src="cordova.js"></script>
        <script type="text/javascript" src="scripts/platformOverrides.js"></script>
        <script type="text/javascript" src="http://maps.google.com/maps/api/js?v=3.17&sensor=false"></script>
        <script>
            function initialize() {
              var mapProp = {
                center:new google.maps.LatLng(51.508742,-0.120850),
                zoom:5,
                mapTypeId:google.maps.MapTypeId.ROADMAP
              };
              var map=new google.maps.Map(document.getElementById("googleMap"), mapProp);
            }
        </script>

    </head>
    <body>
        <div id="googleMap" style="width:500px;height:380px;"></div>
    </body>
</html>

I added whitelist

<access origin="*.google.com" />
  <access origin="*.googleapis.com" />
  <access origin="*.gstatic.com" />
  <access origin="*.googleusercontent.com" />
  <access origin="google.com" subdomains="true"/>
  <access origin="googleapis.com" subdomains="true"/>
  <access origin="gstatic.com" subdomains="true"/>
  <access origin="googleusercontent.com" subdomains="true"/>
  <access origin="http://maps.google.com" subdomains="true"/>
  <access origin="http://*.google.com" subdomains="true"/>
  <access origin="*" />

When run the app,the exception is Can’t load <http://maps.google.com/maps/api/js?v=3.17&sensor=false>.  

can’t load remote web content in the local context.

 

0 Kudos
PaulF_IntelCorp
Employee
414 Views

Try adding this script to your app, see the readme for details > https://github.com/xmnboy/xdk-win8x-compat.js <

0 Kudos
Ilker_O_
Beginner
414 Views

Hi Paul,

I fixed my problem with use this sample.

http://www.creepyed.com/2012/11/how-to-use-the-google-maps-api-on-windows-8/

I don't know this is correct way but map problem was solved.

I change iframe src like this

ondeviceready(){

var lat = getDataInSession('lat');

var long = getDataInSession('long');

var url = ms-appx-web:///www/map.html?lat=lat&long=long

$('#Map').attr(src,url);

}

and then parse the url in the map.js and set lat and long values.

Thank you for your helps.

 

0 Kudos
Reply