title: Cordova Phonegap - Android geolocation shows error: Application does not have sufficient geolocation permissions error
body: <p>On browser and iOS platforms the location works well and shows required data. 
  On the Android it shows current error: </p>
  
  <blockquote>
    <p>Application does not have sufficient geolocation permissions error</p>
  </blockquote>
  
  <p><strong>resources/Config.xml:</strong></p>
  
  <pre><code>&lt;?xml version='1.0' encoding='utf-8'?&gt;
  &lt;widget id="io.cordova.hellocordova" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"&gt;
      &lt;preference name="AllowInlineMediaPlayback" value="false" /&gt;
      &lt;preference name="BackupWebStorage" value="cloud" /&gt;
      &lt;!-- Set DisallowOverscroll to true to avoid bounce effect --&gt;
      &lt;preference name="DisallowOverscroll" value="true" /&gt;
      &lt;preference name="EnableViewportScale" value="false" /&gt;
      &lt;preference name="KeyboardDisplayRequiresUserAction" value="true" /&gt;
      &lt;preference name="MediaPlaybackRequiresUserAction" value="false" /&gt;
      &lt;preference name="SuppressesIncrementalRendering" value="false" /&gt;
      &lt;preference name="GapBetweenPages" value="0" /&gt;
      &lt;preference name="PageLength" value="0" /&gt;
      &lt;preference name="PaginationBreakingMode" value="page" /&gt;
      &lt;preference name="PaginationMode" value="unpaginated" /&gt;
      &lt;feature name="LocalStorage"&gt;
          &lt;param name="ios-package" value="CDVLocalStorage" /&gt;
      &lt;/feature&gt;
      &lt;feature name="HandleOpenUrl"&gt;
          &lt;param name="ios-package" value="CDVHandleOpenURL" /&gt;
          &lt;param name="onload" value="true" /&gt;
      &lt;/feature&gt;
      &lt;feature name="IntentAndNavigationFilter"&gt;
          &lt;param name="ios-package" value="CDVIntentAndNavigationFilter" /&gt;
          &lt;param name="onload" value="true" /&gt;
      &lt;/feature&gt;
      &lt;feature name="GestureHandler"&gt;
          &lt;param name="ios-package" value="CDVGestureHandler" /&gt;
          &lt;param name="onload" value="true" /&gt;
      &lt;/feature&gt;
      &lt;feature name="PushNotification"&gt;
          &lt;param name="ios-package" value="PushPlugin" /&gt;
      &lt;/feature&gt;
      &lt;feature name="Vibration"&gt;
          &lt;param name="ios-package" value="CDVVibration" /&gt;
      &lt;/feature&gt;
      &lt;feature name="Device"&gt;
          &lt;param name="ios-package" value="CDVDevice" /&gt;
      &lt;/feature&gt;
      &lt;feature name="Accelerometer"&gt;
          &lt;param name="ios-package" value="CDVAccelerometer" /&gt;
      &lt;/feature&gt;
      &lt;feature name="Compass"&gt;
          &lt;param name="ios-package" value="CDVCompass" /&gt;
      &lt;/feature&gt;
      &lt;feature name="Contacts"&gt;
          &lt;param name="ios-package" value="CDVContacts" /&gt;
      &lt;/feature&gt;
      &lt;feature name="Camera"&gt;
          &lt;param name="ios-package" value="CDVCamera" /&gt;
      &lt;/feature&gt;
      &lt;preference name="CameraUsesGeolocation" value="false" /&gt;
      &lt;preference name="AndroidPersistentFileLocation" value="Internal" /&gt;
      &lt;feature name="File"&gt;
          &lt;param name="ios-package" value="CDVFile" /&gt;
          &lt;param name="onload" value="true" /&gt;
      &lt;/feature&gt;
      &lt;feature name="Geolocation"&gt;
          &lt;param name="ios-package" value="CDVLocation" /&gt;
      &lt;/feature&gt;
      &lt;feature name="Globalization"&gt;
          &lt;param name="ios-package" value="CDVGlobalization" /&gt;
      &lt;/feature&gt;
      &lt;feature name="InAppBrowser"&gt;
          &lt;param name="ios-package" value="CDVInAppBrowser" /&gt;
      &lt;/feature&gt;
      &lt;feature name="Capture"&gt;
          &lt;param name="ios-package" value="CDVCapture" /&gt;
      &lt;/feature&gt;
      &lt;feature name="NetworkStatus"&gt;
          &lt;param name="ios-package" value="CDVConnection" /&gt;
      &lt;/feature&gt;
      &lt;feature name="SplashScreen"&gt;
          &lt;param name="ios-package" value="CDVSplashScreen" /&gt;
      &lt;/feature&gt;
      &lt;feature name="StatusBar"&gt;
          &lt;param name="ios-package" value="CDVStatusBar" /&gt;
          &lt;param name="onload" value="true" /&gt;
      &lt;/feature&gt;
      &lt;preference name="StatusBarOverlaysWebView" value="true" /&gt;
      &lt;preference name="StatusBarStyle" value="default" /&gt;
      &lt;feature name="Console"&gt;
          &lt;param name="ios-package" value="CDVLogger" /&gt;
      &lt;/feature&gt;
      &lt;feature name="FileTransfer"&gt;
          &lt;param name="ios-package" value="CDVFileTransfer" /&gt;
      &lt;/feature&gt;
      &lt;feature name="CDVWKWebViewEngine"&gt;
          &lt;param name="ios-package" value="CDVWKWebViewEngine" /&gt;
      &lt;/feature&gt;
      &lt;feature name="http://api.phonegap.com/1.0/geolocation"/&gt;
      &lt;plugin name="cordova-plugin-geolocation" source="npm" /&gt;
      &lt;preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" /&gt;
      &lt;allow-intent href="itms:*" /&gt;
      &lt;allow-intent href="itms-apps:*" /&gt;
      &lt;name&gt;HelloCordova&lt;/name&gt;
      &lt;description&gt;
          A sample Apache Cordova application that responds to the deviceready event.
      &lt;/description&gt;
      &lt;author email="dev@cordova.apache.org" href="http://cordova.io"&gt;
          Apache Cordova Team
      &lt;/author&gt;
      &lt;content src="index.html" /&gt;
      &lt;access origin="*" /&gt;
      &lt;allow-navigation href="http://*.websitename.com" /&gt;
       &lt;allow-navigation href="https://*.youtube.com" /&gt;
      &lt;allow-intent href="http://*/*" /&gt;
      &lt;allow-intent href="https://*/*" /&gt;
      &lt;allow-intent href="tel:*" /&gt;
      &lt;allow-intent href="sms:*" /&gt;
      &lt;allow-intent href="mailto:*" /&gt;
      &lt;allow-intent href="geo:*" /&gt;
  &lt;/widget&gt;
  </code></pre>
  
  <p><strong>Android/res/xml/config.xml</strong></p>
  
  <pre><code>&lt;?xml version='1.0' encoding='utf-8'?&gt;
  &lt;widget id="io.cordova.hellocordova" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"&gt;
      &lt;preference name="AllowInlineMediaPlayback" value="false" /&gt;
      &lt;preference name="BackupWebStorage" value="cloud" /&gt;
      &lt;!-- Set DisallowOverscroll to true to avoid bounce effect --&gt;
      &lt;preference name="DisallowOverscroll" value="true" /&gt;
      &lt;preference name="EnableViewportScale" value="false" /&gt;
      &lt;preference name="KeyboardDisplayRequiresUserAction" value="true" /&gt;
      &lt;preference name="MediaPlaybackRequiresUserAction" value="false" /&gt;
      &lt;preference name="SuppressesIncrementalRendering" value="false" /&gt;
      &lt;preference name="GapBetweenPages" value="0" /&gt;
      &lt;preference name="PageLength" value="0" /&gt;
      &lt;preference name="PaginationBreakingMode" value="page" /&gt;
      &lt;preference name="PaginationMode" value="unpaginated" /&gt;
      &lt;feature name="LocalStorage"&gt;
          &lt;param name="ios-package" value="CDVLocalStorage" /&gt;
      &lt;/feature&gt;
      &lt;feature name="HandleOpenUrl"&gt;
          &lt;param name="ios-package" value="CDVHandleOpenURL" /&gt;
          &lt;param name="onload" value="true" /&gt;
      &lt;/feature&gt;
      &lt;feature name="IntentAndNavigationFilter"&gt;
          &lt;param name="ios-package" value="CDVIntentAndNavigationFilter" /&gt;
          &lt;param name="onload" value="true" /&gt;
      &lt;/feature&gt;
      &lt;feature name="GestureHandler"&gt;
          &lt;param name="ios-package" value="CDVGestureHandler" /&gt;
          &lt;param name="onload" value="true" /&gt;
      &lt;/feature&gt;
      &lt;feature name="PushNotification"&gt;
          &lt;param name="ios-package" value="PushPlugin" /&gt;
      &lt;/feature&gt;
      &lt;feature name="Vibration"&gt;
          &lt;param name="ios-package" value="CDVVibration" /&gt;
      &lt;/feature&gt;
      &lt;feature name="Device"&gt;
          &lt;param name="ios-package" value="CDVDevice" /&gt;
      &lt;/feature&gt;
      &lt;feature name="Accelerometer"&gt;
          &lt;param name="ios-package" value="CDVAccelerometer" /&gt;
      &lt;/feature&gt;
      &lt;feature name="Compass"&gt;
          &lt;param name="ios-package" value="CDVCompass" /&gt;
      &lt;/feature&gt;
      &lt;feature name="Contacts"&gt;
          &lt;param name="ios-package" value="CDVContacts" /&gt;
      &lt;/feature&gt;
      &lt;feature name="Camera"&gt;
          &lt;param name="ios-package" value="CDVCamera" /&gt;
      &lt;/feature&gt;
      &lt;preference name="CameraUsesGeolocation" value="false" /&gt;
      &lt;preference name="AndroidPersistentFileLocation" value="Internal" /&gt;
      &lt;feature name="File"&gt;
          &lt;param name="ios-package" value="CDVFile" /&gt;
          &lt;param name="onload" value="true" /&gt;
      &lt;/feature&gt;
      &lt;feature name="Geolocation"&gt;
          &lt;param name="ios-package" value="CDVLocation" /&gt;
      &lt;/feature&gt;
      &lt;feature name="Globalization"&gt;
          &lt;param name="ios-package" value="CDVGlobalization" /&gt;
      &lt;/feature&gt;
      &lt;feature name="InAppBrowser"&gt;
          &lt;param name="ios-package" value="CDVInAppBrowser" /&gt;
      &lt;/feature&gt;
      &lt;feature name="Capture"&gt;
          &lt;param name="ios-package" value="CDVCapture" /&gt;
      &lt;/feature&gt;
      &lt;feature name="NetworkStatus"&gt;
          &lt;param name="ios-package" value="CDVConnection" /&gt;
      &lt;/feature&gt;
      &lt;feature name="SplashScreen"&gt;
          &lt;param name="ios-package" value="CDVSplashScreen" /&gt;
      &lt;/feature&gt;
      &lt;feature name="StatusBar"&gt;
          &lt;param name="ios-package" value="CDVStatusBar" /&gt;
          &lt;param name="onload" value="true" /&gt;
      &lt;/feature&gt;
      &lt;preference name="StatusBarOverlaysWebView" value="true" /&gt;
      &lt;preference name="StatusBarStyle" value="default" /&gt;
      &lt;feature name="Console"&gt;
          &lt;param name="ios-package" value="CDVLogger" /&gt;
      &lt;/feature&gt;
      &lt;feature name="FileTransfer"&gt;
          &lt;param name="ios-package" value="CDVFileTransfer" /&gt;
      &lt;/feature&gt;
      &lt;feature name="CDVWKWebViewEngine"&gt;
          &lt;param name="ios-package" value="CDVWKWebViewEngine" /&gt;
      &lt;/feature&gt;
      &lt;feature name="http://api.phonegap.com/1.0/geolocation"/&gt;
      &lt;plugin name="cordova-plugin-geolocation" source="npm" /&gt;    
      &lt;preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" /&gt;
      &lt;allow-intent href="itms:*" /&gt;
      &lt;allow-intent href="itms-apps:*" /&gt;
      &lt;name&gt;HelloCordova&lt;/name&gt;
      &lt;description&gt;
          A sample Apache Cordova application that responds to the deviceready event.
      &lt;/description&gt;
      &lt;author email="dev@cordova.apache.org" href="http://cordova.io"&gt;
          Apache Cordova Team
      &lt;/author&gt;
      &lt;content src="index.html" /&gt;
      &lt;access origin="*" /&gt;
      &lt;allow-navigation href="http://*.websitename.com" /&gt;
       &lt;allow-navigation href="https://*.youtube.com" /&gt;
      &lt;allow-intent href="http://*/*" /&gt;
      &lt;allow-intent href="https://*/*" /&gt;
      &lt;allow-intent href="tel:*" /&gt;
      &lt;allow-intent href="sms:*" /&gt;
      &lt;allow-intent href="mailto:*" /&gt;
      &lt;allow-intent href="geo:*" /&gt;
  &lt;/widget&gt;
  </code></pre>
  
  <p><strong>AndroidManifest.xml</strong></p>
  
  <pre><code>&lt;?xml version='1.0' encoding='utf-8'?&gt;
  &lt;manifest android:hardwareAccelerated="true" android:versionCode="1" android:versionName="0.0.1" package="io.cordova.hellocordova" xmlns:android="http://schemas.android.com/apk/res/android"&gt;
      &lt;supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" /&gt;
      &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" /&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" /&gt;
      &lt;application android:hardwareAccelerated="true" android:icon="@drawable/icon" android:label="app name" android:supportsRtl="true"&gt;
          &lt;activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:theme="@android:style/Theme.DeviceDefault.NoActionBar" android:windowSoftInputMode="adjustResize"&gt;
              &lt;intent-filter android:label="@string/launcher_name"&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
      &lt;/application&gt;
      &lt;uses-sdk android:minSdkVersion="14" android:targetSdkVersion="23" /&gt;
  &lt;/manifest&gt;
  </code></pre>
  
  <p><strong>Plugins/org.apache.cordova.geolocation/plugin.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!--
    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you under the Apache License, Version 2.0 (the
    "License"); you may not use this file except in compliance
    with the License.  You may obtain a copy of the License at
  
      http://www.apache.org/licenses/LICENSE-2.0
  
    Unless required by applicable law or agreed to in writing,
    software distributed under the License is distributed on an
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, either express or implied.  See the License for the
    specific language governing permissions and limitations
    under the License.
  --&gt;
  
  &lt;plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:rim="http://www.blackberry.com/ns/widgets" xmlns:android="http://schemas.android.com/apk/res/android" id="org.apache.cordova.geolocation" version="0.3.12"&gt;
      &lt;name&gt;Geolocation&lt;/name&gt;
      &lt;description&gt;Cordova Geolocation Plugin&lt;/description&gt;
      &lt;license&gt;Apache 2.0&lt;/license&gt;
      &lt;keywords&gt;cordova,geolocation&lt;/keywords&gt;
      &lt;repo&gt;https://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation.git&lt;/repo&gt;
      &lt;issue&gt;https://issues.apache.org/jira/browse/CB/component/12320638&lt;/issue&gt;
      &lt;!-- android --&gt;
      &lt;platform name="android"&gt;
          &lt;config-file target="AndroidManifest.xml" parent="/*"&gt;
              &lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /&gt;
              &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /&gt;
          &lt;/config-file&gt;
      &lt;/platform&gt;
      &lt;!-- amazon-fireos --&gt;
      &lt;platform name="amazon-fireos"&gt;
          &lt;config-file target="AndroidManifest.xml" parent="/*"&gt;
              &lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /&gt;
              &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /&gt;
          &lt;/config-file&gt;
      &lt;/platform&gt;
      &lt;!-- ios --&gt;
      &lt;platform name="ios"&gt;
          &lt;js-module src="www/Coordinates.js" name="Coordinates"&gt;
              &lt;clobbers target="Coordinates" /&gt;
          &lt;/js-module&gt;
  
          &lt;js-module src="www/PositionError.js" name="PositionError"&gt;
              &lt;clobbers target="PositionError" /&gt;
          &lt;/js-module&gt;
  
          &lt;js-module src="www/Position.js" name="Position"&gt;
              &lt;clobbers target="Position" /&gt;
          &lt;/js-module&gt;
  
          &lt;js-module src="www/geolocation.js" name="geolocation"&gt;
              &lt;clobbers target="navigator.geolocation" /&gt;
          &lt;/js-module&gt;
  
          &lt;config-file target="config.xml" parent="/*"&gt;
              &lt;feature name="Geolocation"&gt;
                  &lt;param name="ios-package" value="CDVLocation"/&gt;
              &lt;/feature&gt;
          &lt;/config-file&gt;
          &lt;header-file src="src/ios/CDVLocation.h" /&gt;
          &lt;source-file src="src/ios/CDVLocation.m" /&gt;
          &lt;framework src="CoreLocation.framework" /&gt;
  
          &lt;config-file target="*-Info.plist" parent="NSLocationWhenInUseUsageDescription"&gt;
              &lt;string&gt;&lt;/string&gt;
          &lt;/config-file&gt;
      &lt;/platform&gt;
      &lt;!-- blackberry10 --&gt;
      &lt;platform name="blackberry10"&gt;
          &lt;js-module src="www/blackberry10/GeolocationProxy.js" name="GeolocationProxy"&gt;
              &lt;runs /&gt;
          &lt;/js-module&gt;
  
          &lt;js-module src="www/Coordinates.js" name="Coordinates"&gt;
              &lt;clobbers target="Coordinates" /&gt;
          &lt;/js-module&gt;
  
          &lt;js-module src="www/PositionError.js" name="PositionError"&gt;
              &lt;clobbers target="PositionError" /&gt;
          &lt;/js-module&gt;
  
          &lt;js-module src="www/Position.js" name="Position"&gt;
              &lt;clobbers target="Position" /&gt;
          &lt;/js-module&gt;
  
          &lt;js-module src="www/geolocation.js" name="geolocation"&gt;
              &lt;clobbers target="navigator.geolocation" /&gt;
          &lt;/js-module&gt;
  
          &lt;config-file target="www/config.xml" parent="/widget"&gt;
              &lt;feature name="Geolocation" value="Geolocation"/&gt;
          &lt;/config-file&gt;
  
          &lt;config-file target="www/config.xml" parent="/widget/rim:permissions"&gt;
            &lt;rim:permit&gt;read_geolocation&lt;/rim:permit&gt;
          &lt;/config-file&gt;
      &lt;/platform&gt;
  
      &lt;!-- ubuntu --&gt;
      &lt;platform name="ubuntu"&gt;
          &lt;js-module src="www/Coordinates.js" name="Coordinates"&gt;
              &lt;clobbers target="Coordinates" /&gt;
          &lt;/js-module&gt;
  
          &lt;js-module src="www/PositionError.js" name="PositionError"&gt;
              &lt;clobbers target="PositionError" /&gt;
          &lt;/js-module&gt;
  
          &lt;js-module src="www/Position.js" name="Position"&gt;
              &lt;clobbers target="Position" /&gt;
          &lt;/js-module&gt;
  
          &lt;js-module src="www/geolocation.js" name="geolocation"&gt;
              &lt;clobbers target="navigator.geolocation" /&gt;
          &lt;/js-module&gt;
  
          &lt;source-file src="src/ubuntu/geolocation.cpp" /&gt;
          &lt;header-file src="src/ubuntu/geolocation.h" /&gt;
          &lt;config-file target="config.xml" parent="/*"&gt;
              &lt;feature name="Geolocation"&gt;
                  &lt;param policy_group="location" policy_version="1" /&gt;
              &lt;/feature&gt;
          &lt;/config-file&gt;
      &lt;/platform&gt;
  
      &lt;!-- wp7 --&gt;
      &lt;platform name="wp7"&gt;
  
          &lt;config-file target="Properties/WMAppManifest.xml" parent="/Deployment/App/Capabilities"&gt;
              &lt;Capability Name="ID_CAP_LOCATION" /&gt;
          &lt;/config-file&gt;
  
          &lt;source-file src="src/wp/Geolocation.cs" /&gt;
      &lt;/platform&gt;
  
      &lt;!-- wp8 --&gt;
      &lt;platform name="wp8"&gt;
  
          &lt;config-file target="Properties/WMAppManifest.xml" parent="/Deployment/App/Capabilities"&gt;
              &lt;Capability Name="ID_CAP_LOCATION" /&gt;
          &lt;/config-file&gt;
  
          &lt;source-file src="src/wp/Geolocation.cs" /&gt;
      &lt;/platform&gt;
  
      &lt;!-- windows8 --&gt;
      &lt;platform name="windows8"&gt;
          &lt;config-file target="package.appxmanifest" parent="/Package/Capabilities"&gt;
              &lt;DeviceCapability Name="location" /&gt;
          &lt;/config-file&gt;
  
          &lt;js-module src="src/windows/GeolocationProxy.js" name="GeolocationProxy"&gt;
              &lt;runs /&gt;
          &lt;/js-module&gt;
  
          &lt;js-module src="www/Coordinates.js" name="Coordinates"&gt;
              &lt;clobbers target="Coordinates" /&gt;
          &lt;/js-module&gt;
  
          &lt;js-module src="www/PositionError.js" name="PositionError"&gt;
              &lt;clobbers target="PositionError" /&gt;
          &lt;/js-module&gt;
  
          &lt;js-module src="www/Position.js" name="Position"&gt;
              &lt;clobbers target="Position" /&gt;
          &lt;/js-module&gt;
  
          &lt;js-module src="www/geolocation.js" name="geolocation"&gt;
              &lt;clobbers target="navigator.geolocation" /&gt;
          &lt;/js-module&gt;
      &lt;/platform&gt;
  
      &lt;!-- windows universal apps (Windows 8.1, Windows Phone 8.1, Windows 8.0) --&gt;
      &lt;platform name="windows"&gt;
          &lt;config-file target="package.appxmanifest" parent="/Package/Capabilities"&gt;
              &lt;DeviceCapability Name="location" /&gt;
          &lt;/config-file&gt;
  
          &lt;js-module src="src/windows/GeolocationProxy.js" name="GeolocationProxy"&gt;
              &lt;runs /&gt;
          &lt;/js-module&gt;
  
          &lt;js-module src="www/Coordinates.js" name="Coordinates"&gt;
              &lt;clobbers target="Coordinates" /&gt;
          &lt;/js-module&gt;
  
          &lt;js-module src="www/PositionError.js" name="PositionError"&gt;
              &lt;clobbers target="PositionError" /&gt;
          &lt;/js-module&gt;
  
          &lt;js-module src="www/Position.js" name="Position"&gt;
              &lt;clobbers target="Position" /&gt;
          &lt;/js-module&gt;
  
          &lt;js-module src="www/geolocation.js" name="geolocation"&gt;
              &lt;clobbers target="navigator.geolocation" /&gt;
          &lt;/js-module&gt;
      &lt;/platform&gt;
  
      &lt;!-- firefoxos --&gt;
      &lt;platform name="firefoxos"&gt;
        &lt;config-file target="config.xml" parent="/*"&gt;
            &lt;permission name="geolocation" description="Required for accessing user location." /&gt;
        &lt;/config-file&gt;
  
          &lt;js-module src="src/firefoxos/GeolocationProxy.js" name="GeolocationProxy"&gt;
              &lt;runs /&gt;
          &lt;/js-module&gt;
  
          &lt;js-module src="www/Coordinates.js" name="Coordinates"&gt;
              &lt;clobbers target="Coordinates" /&gt;
          &lt;/js-module&gt;
  
          &lt;js-module src="www/PositionError.js" name="PositionError"&gt;
              &lt;clobbers target="PositionError" /&gt;
          &lt;/js-module&gt;
  
          &lt;js-module src="www/Position.js" name="Position"&gt;
              &lt;clobbers target="Position" /&gt;
          &lt;/js-module&gt;
  
          &lt;js-module src="www/geolocation.js" name="geolocation"&gt;
              &lt;clobbers target="navigator.geolocation" /&gt;
          &lt;/js-module&gt;
      &lt;/platform&gt;
  &lt;/plugin&gt;
  </code></pre>
  
  <p><strong>Javascript for fetching location:</strong></p>
  
  <pre><code>&lt;script&gt;
    window.onload = function() {
      document.addEventListener("deviceready", init, false);
      document.addEventListener("deviceready", onDeviceReady, false);
    }
  
    function init() {
      navigator.geolocation.getCurrentPosition(positionSuccess, positionError);
    }
  
    function onDeviceReady(){
  
    }
  
    function positionSuccess(position) {
      var latitude = position.coords.latitude;
      var longitude = position.coords.longitude;
      document.getElementById('lat').value = latitude;
      document.getElementById('lon').value = longitude;
    }
  
    function positionError(error) {
      alert(error.message);
    }
  &lt;/script&gt;
  </code></pre>
  
  <p>Any advice or help would be appreciated. </p>