The context here is I check whether the device's location is on or off. If it is off it gives a alert dialog to go to location settings. On click of Proceed button a call back is made to the successAlert function(below code). Once it enters successAlert function there is a watcPosition called to look for change in position if at all the user has turned on location settings. If so then since location has changed the onSuccess function has to be called to display new location on map.
function successAlert(msg) {
alert("inside successAlert");
watchId = navigator.geolocation.watchPosition(onSuccess);
}
This is the code. The successAlert function is called on async call back, then a watchPosition timer is started to look for change in position of the device. If at all there is change in position it should call onSuccess callback function. The callback function is called when an alert is present like in the code above else the callback is not called. What could be the reason? How to solve this?