Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
<pre>// Function to get location
    function getLocation() {
        navigator.geolocation.getCurrentPosition(function (pos) {
            var lat = pos.coords.latitude;
            var lng = pos.coords.longitude;
            if (lat == null) {
                navigator.notification.alert("GPS not activated!", null, "GPS", "Ok");
            }
            else {
                navigator.notification.alert("Latitude: " + lat + " , Longitude: " + lng, null, "GPS", "Ok");
            }
        });
    }</pre>


What I have tried:

How to find user device is GPS on or off in javascript?
how to i resolve this.
Posted
Updated 17-Dec-16 2:35am

1 solution

You already posted this in the Javascript forum; please do not multi-post the same question.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900