AnsweredAssumed Answered

detecting if location services on mobile devices are enabled

Question asked by franklin.alexander on Mar 7, 2018
Latest reply on Mar 20, 2018 by franklin.alexander

Does anyone know a good way to check to see if location services are enabled/disabled on a mobile device? I have tried using the following with no luck: 

var isMobile = window.matchMedia("only screen and (max-width: 760px)");
if (isMobile.matches) {
   if (!window.navigator.geolocation) {

I am just trying to alert the user with a popup that states that location services must be enabled to use the 'My Location' tool in the widget. I tried locating the above code in the startup() function, as well as the function where the locate button is initiated, and finally in the function that gets called when the button is clicked, but to no avail.. I am just wandering if there is a better method to do this for mobile devices, but haven't found much via Google.