Phonegap Build config.xml and geolocation

254 Views Asked by At

I have a really odd issue with using geolocation with PhoneGap build. I have it working with my config.xml that looks like this:

<?xml version='1.0' encoding='utf-8'?>
<widget id="net.seekadventure" version="0.0.2" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
  <name>Seek Adventure Map</name>
  <description>
      A map to help you find your next Adventure!
  </description>
  <author email="myEmail" href="https://www.seekadventure.net">
      Seek ADventure Team
  </author>
  <content src="index.html" />
  <plugin name="cordova-plugin-whitelist" spec="1" />



    <preference name="permissions" value="none"/>
    <feature name="http://api.phonegap.com/1.0/geolocation"/>

    <plugin name="cordova-plugin-geolocation" spec="1" />

<icon src="icon.png" />


  <access origin="*" />
  <allow-intent href="http://*/*" />
  <allow-intent href="https://*/*" />
  <allow-intent href="tel:*" />
  <allow-intent href="sms:*" />
  <allow-intent href="mailto:*" />
  <allow-intent href="geo:*" />
  <platform name="android">
      <allow-intent href="market:*" />
  </platform>
  <platform name="ios">
      <allow-intent href="itms:*" />
      <allow-intent href="itms-apps:*" />
  </platform>
</widget>

The off part is that when I install it and open it on my phone it gives me a pop up that says this:

"This app was built for an older version of Android and may not work properly. Try checking for updates, or contact the developer"

Since I got that error I did some research and added this to my config.xml

<preference name="android-minSdkVersion" value="27" />
  <preference name="android-maxSdkVersion" value="29" />
  <preference name="android-targetSdkVersion" value="28" />

When I add the above code it fixes the error about being built on an old version but the GPS permissions don't work.... Any ideas?

Update:

I also tried specifying source and version for the plugin and that didn't help:

<plugin name="cordova-plugin-geolocation" source="npm" spec="4.0.2" />
1

There are 1 best solutions below

0
Ten Digit Grid On BEST ANSWER

I was not specifying the CLI version in my config/xml which is what caused the issue:

  <preference name="phonegap-version" value="cli-9.0.0" />