Ken Vernaillen
Ken Vernaillen

Reputation: 859

Worklight - WL.Device.Geo.acquirePosition or navigator.geolocation?

I try to get the location of the device, to show on google maps. Currently I use the following code:

    if (navigator.geolocation) {
                    navigator.geolocation.getCurrentPosition(function(position) {
                        var latlng = new google.maps.LatLng(
                                position.coords.latitude,
                                position.coords.longitude);
    ...

I just read Worklight has a WL.Device.Geo.acquirePosition function.

What is the best to use?

Upvotes: 1

Views: 396

Answers (1)

David Dhuyveter
David Dhuyveter

Reputation: 1416

what you are doing is fine. THE WL.Device.geo api has a lot more that you can do than navigator.geolocation. But if all you are doing is plotting your current location on a map, either api will do.

Upvotes: 2

Related Questions