Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49184

How to get Latitude and Longitude from IONIC

$
0
0

@rranjan wrote:

How can i get Latitude and Longitude from IONIC Cordova.

I am using following plugin for getting Lat/Lng.

cordova-plugin-geolocation 2.1.0 "Geolocation"

And

    var options = { timeout: 3000, enableHighAccuracy: true  };

    document.addEventListener('deviceready', function () {
        navigator.geolocation.getCurrentPosition(onSuccess, onError, options);
    });

    function onSuccess(position) {

        latvalue = position.coords.latitude;
        lngvalue = position.coords.longitude;
        timestamp = position.timestamp;

        alert(latvalue);

    }

    function onError(error)
    {
      alert(error);
   }

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 49184

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>