Push Notification if Location disable in mobile


#1

Hi Friends,
I am using ngCordova. Where I installed cordova plugin add cordova-plugin-geolocation.

var posOptions = {timeout: 10000, enableHighAccuracy: false};
$scope.cLoc = $cordovaGeolocation;
console.log($cordovaGeolocation);
if(Object.keys($cordovaGeolocation).length){
$cordovaGeolocation.getCurrentPosition(posOptions).then(function (position) {
$scope.lat = position.coords.latitude
$scope.long = position.coords.longitude
}, function(err) {
$scope.err1 = err;
});

    var watchOptions = {
        frequency : 1000,
        timeout : 3000,
        enableHighAccuracy: true // may cause errors if true
    };

    var watch = $cordovaGeolocation.watchPosition(watchOptions);
    watch.then(null,function(err) {
        $scope.err2 = err;
    },
    function(position) {
        $scope.latWatch  = position.coords.latitude
        $scope.longWatch = position.coords.longitude
    });    
}else{
    *alert("Geolocation off");*
}

So how can we find. Location service on/off in Mobile device.
If it off. How to re-direct into setting-> location for enable the
services.