Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Ilker_O_
Beginner
80 Views

Maps on Windows Phone 8.1

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?

 

Tags (2)
0 Kudos
4 Replies
Elroy_A_Intel
Employee
80 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.

Ilker_O_
Beginner
80 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.

 

PaulF_IntelCorp
Employee
80 Views

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

Ilker_O_
Beginner
80 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.

 

Reply