How to make location get updated when the user move ? (Bing maps on JS WIN8)


  • Sorry if I ask too much questions about maps in win8 API ,but I appreciate the helps and it's only because I'm new to this world 

    But is it possible to make the location of the user always get updated every time he moves with the device? Where should i put the JS function ? on load() in the hml head?  

    here is some of my code of my javascript 

    Again thanks a lot !

    unction () {
        "use strict";
        var app = WinJS.Application;
        var activation = Windows.ApplicationModel.Activation;
        var map;
        app.onactivated = function (args) {
            if (args.detail.kind === activation.ActivationKind.launch) {
                if (args.detail.previousExecutionState !== activation.ApplicationExecutionState.terminated) {
                } else {
                args.setPromise(WinJS.UI.processAll().then(function () {
                    Microsoft.Maps.loadModule('Microsoft.Maps.Map', { callback: initMap });
        function initMap() {
            try {
                centerPosition();//Locate the adress 
                document.querySelector('#setLocation').addEventListener('click', centerPosition,false);//return to adress
                var mapOptions =
                    credentials: "Atu0aMfGjfMho8ryXcT8G0YGVXuRmAyglkIvBOKTzt3WP9qLi0txukM-6VYRUzfw",
                    center: new Microsoft.Maps.Location(45.5000, -73.5833, 173),
                    //Set map location 
                    mapTypeId: Microsoft.Maps.MapTypeId.road,
                    zoom: 10

    Wednesday, April 3, 2013 7:49 PM