Compilation process overvwrites my config.xml


Ive got a specific problem in my project.
I want to use a native GPS on Android. Ive added a geolocation module to my project with

cordova plugins add org.apache.cordova.geolocation

Than added to AndroidManifest.xml this code:

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />

Than added code to platforms/android/res/xml/config.xml

<feature name="Geolocation">
    <param name="android-package" value="org.apache.cordova.geolocation.GeoBroker" />

Than Im running a code with

ionic run android

And the file platforms/android/res/xml/config.xml is overwriten and my added code:

 <feature name="Geolocation">
    <param name="android-package" value="org.apache.cordova.geolocation.GeoBroker" />

is removed from this file. Finally I cannot use native GPS and it still uses a webview geolocation.

Could you help me to resolve this problem?

Hey @fedojo,

A couple things:

  1. From my experience you cannot really edit the AndroidManifest.xml - it gets written when you build your project i.e. ionic run android . Not edits you make to android manifest will ever make it back to your config.xml, it’s a way one street from config to manifest.

  2. the reason native geolocation isnt working is because it was removed, see this stackoverflow post:
    the good news is that it was removed because they say the web implementation works just fine. In my experience its worked great. In particular Angular-GoogleMaps works great with Ionic:!/

Hope this helps,

Thank you @sakotturi !

I was still thinking that geolocation is working … Thanks for link :slight_smile:

Im now digging into
I think it will help me to solve my problem.