The following forum(s) have migrated to Microsoft Q&A (Preview): Developing Universal Windows apps!
Visit Microsoft Q&A (Preview) to post new questions.

Learn More

 locked
Windows Phone + Phonegap + Maps RRS feed

  • Question

  • Hi, I am developing am application that uses mapping services. I have tried Google Maps, Here Maps and Bing Maps api.

    Is it possible to use windows phone 8 native maps with Phonegap javascript?

    Think it has be either with a Phonegap plugin or using .cs

    Thanks,

    Lloyd.

    Tuesday, July 29, 2014 3:47 PM

All replies

  • either use map launcher or use map element for all the map controls to navigate, push, pin, etc.  add following namespaces

    using Microsoft.Phone.Maps.Controls;

    and to locate current location use 

    using  System.Device.Location;

    but make sure that you enable the Map capabilities from AppManifest

    Tuesday, July 29, 2014 4:00 PM
  • I know have to add the resource.

    Add. <Capability Name="ID_CAP_MAP" />

    How to access the native map object using javascript? Any examples?

    Bing maps init using javascript.

    function initMap(lat, lon) {
        mapinint = true;
        
        var mapOptions = {
            credentials: " ",
            showDashboard: false,
            showCopyright: false,
            showScalebar: true,
            enableSearchLogo: false,
            enableClickableLogo: false,
            backgroundColor: new Microsoft.Maps.Color(255, 0, 0, 0)
        };

        // Initialize the map
        map = new Microsoft.Maps.Map(document.getElementById("trackerMap"), mapOptions);
        
        var loc = new Microsoft.Maps.Location(lat, lon);

        // Display result on map        
        marker_0 = new Microsoft.Maps.Pushpin(loc);
        map.entities.push(marker_0);

        // Zoom to result
        map.setView({ center: loc, zoom: 14 });
    }



    • Edited by LLcooL1 Wednesday, July 30, 2014 8:08 AM
    Wednesday, July 30, 2014 8:05 AM