Fix for “GPS Provider Disabled” using Apache Cordova on Android

less than 1 minute read

The Problem

I recently ran into the issue of “GPS Provider Disabled” when using Apache Cordova on Android. After reading many threads the fix seemed to always be to set the permissions in config.xml with the following code:

<gap:plugin name="org.apache.cordova.geolocation" />
<feature name="http://api.phonegap.com/1.0/geolocation"/>

After doing that you would need to check Settings –> Location and make sure it is on.

If it didn’t work after that well you were pretty much on your own…

The Resolution

After digging I found that if I include enableHighAccuracy to false then it would use Assisted GPS rather than satellite positioning. Sure the results may not be as high as you would like but it is better than an ugly dialog box saying “GPS Provider Disabled”.

Here is a full sample:

<!DOCTYPE html>
<html>
  <head>
    <title>Device Properties Example</title>
 
    <script type="text/javascript" charset="utf-8" src="cordova-2.5.0.js"></script>
    <script type="text/javascript" charset="utf-8">
 
      
      


      
        

Updated:

Leave a Comment