Cordova Angularjs ask for GPS
<p>I program an app where I need GPS.
If the GPS is off, how can I ask the user to turn on GPS, like google maps? After a while of googleing I found nothing compareable...
My other question is, why I get "Use location? - 2", when the GPS is off? I thought, if the GPS is off, $window.navigator.geolocation is false?</p>

<p><a href="https://i.stack.imgur.com/2m6wd.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2m6wd.png" alt="Google Maps"></a></p>

<p>controller.js</p>

<pre><code>if ($window.navigator &amp;&amp; $window.navigator.geolocation) { 
    function success(pos) {
        $rootScope.position = { x: pos.coords.latitude, y: pos.coords.longitude };
    }
    function fail(error) {
        alert("Use location? - 2");
    }
     $window.navigator.geolocation.getCurrentPosition(success, fail, { maximumAge: 500000, enableHighAccuracy: true, timeout: 6000 });
} else {
    alert("Use location? - 1");
}
</code></pre>