1

I have a Mapview in my Titanium project. I can get the map to focus on a specefic latitude and longitude on load, but I can't seem to get it to focus on users currentLocation on load? What is the code for that?

Thanks.

0

1 Answer 1

2

You can get your current location using getCurrentPosition function and then focus map to this location. Here is an example:

Ti.Geolocation.getCurrentPosition(function(e) {
    if (e.error) {
        return; 
    }

    storesMap.setLocation({
        latitude : e.coords.latitude,
        longitude : e.coords.longitude,
        latitudeDelta : 0.01,
        longitudeDelta : 0.01
    });
});

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.