How Can I Get marker on current location in map in Sencha-Touch2.0

后端 未结 3 1808
不思量自难忘°
不思量自难忘° 2020-12-20 21:11

Hey friends i m new to Sencha Touch platform.

And I want to find user current location with marker please help me out. i s

3条回答
  •  借酒劲吻你
    2020-12-20 21:43

    I have also work for simillar app using sencha touch 2.3.1
    Using Ext.util.Geolocation class for get current location and automatically update the currentPosition using the following code.

    Ext.create('Ext.util.Geolocation', {
    autoUpdate: true,
    allowHighAccuracy: true,
    frequency: '5000', // set the milliseconds for the location update
    listeners: {
    locationupdate: function(geo) {
        latitude=Global.currentUserLocations.currentLat;
        longitude=Global.currentUserLocations.currentLong;
        if(Global.currentUserPositionMarker)
        {
            latlng1=new google.maps.LatLng(latitude, longitude);
            Global.currentUserPositionMarker.setPosition(latlng1);
        }
       }
     }
    });  
    

    The above code worked for me and i have already used in my app for getting currentLocation and moved the marker into currentPosition.

提交回复
热议问题