locked
Bing Maps with Apache Cordova RRS feed

  • Question

  • I am currently trying to use the Bing Maps AJAX API v7 in the new 'Multi-device hybrid App" template provided in Visual Studio, which uses Apache Cordova to provide crossplatform compatibility. I have written the following code, following the template  at http://msdn.microsoft.com/en-us/library/gg427624.aspx :

     
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html>
    <head>
        <meta charset="utf-8" />
        <title>Wand</title>
    
        <!-- Wand references -->
        <link href="css/index.css" rel="stylesheet" />
    
        <script charset="UTF-8" type="text/javascript" src="https://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0&s=1">
        </script>
    
        <script type="text/javascript">
    
        function GetMap() {
            var map = new Microsoft.Maps.Map(document.getElementById("map"), { credentials: "AgegeewHkb9iTTQDLseMTuQyxQyZybs7uUv7aqIgKu6U8CiaflVNApy5WtDXqtHr " });
        }
    
        </script>
    
    </head>
    <body onload="GetMap();">
        
        <div id='map' class="mainview"></div>
        <div class="menu">This is the menu</div>
        <!-- Cordova reference, this is added to your app when it's built. -->
        <script src="cordova.js"></script>
    
        <script src="scripts/index.js"></script>
    
        
    
    </body>
    </html>

    But when I debug it in Windows 8.1, it says that Microsoft is not defined (in the GetMap function). I asume that the library from

    https://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0&s=1

    has not been loaded properly. Is there anything wrong with my code? Should I use the AJAX WEB API, or is there another for apps (the only one I have seen is for Windows 8 only)?

    I think that my app is unable to load the web library because it doesn't have the proper permisions. In the config.xml there is a domain access section, but it says it doesn't appy to the windows platform, so how can I set it to allow loading pages from https://ecn.dev.virtualearth.net ?

    PS: I have posted this there after positing a similar post in the Bing Maps section with no luck, and because there is no Multiplatform development section.

    Tuesday, June 24, 2014 9:51 AM

Answers

All replies