Reputation: 859
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
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