Bing Maps in 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">
        <meta charset="utf-8" />
        <!-- 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 type="text/javascript">
        function GetMap() {
            var map = new Microsoft.Maps.Map(document.getElementById("map"), { credentials: "My Bing Maps Key" });
    <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>
    But when I debug, it says that Microsoft is not defined (in the GetMap function). I asume that the library from


    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)?PS: I'm not sure if I should ask this in a platform development related fórum instead of the bing one, but since there is no one for multiplatform development with cordova I'll leave it here, mods please move it if you consider.

    Monday, June 23, 2014 7:14 PM


All replies