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:
<SPAN class="keyword token">var</SPAN> isMobile <SPAN class="operator token">=</SPAN> window<SPAN class="punctuation token">.</SPAN><SPAN class="token function">matchMedia</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"only screen and (max-width: 760px)"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">if</SPAN> <SPAN class="punctuation token">(</SPAN>isMobile<SPAN class="punctuation token">.</SPAN>matches<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
<SPAN class="keyword token">if</SPAN> <SPAN class="punctuation token">(</SPAN><SPAN class="operator token">!</SPAN>window<SPAN class="punctuation token">.</SPAN>navigator<SPAN class="punctuation token">.</SPAN>geolocation<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
<SPAN class="keyword token">this</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="token function">_displayWidgetError</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">this</SPAN><SPAN class="punctuation token">.</SPAN>nls<SPAN class="punctuation token">.</SPAN>noGPSMobileContent<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>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.