Hi,
I am struggling a little with the “edit-config” to have the gps set as not mandatory in “AndroidManifest.xml”.
By default, it is set as
<uses-feature
android:name="android.hardware.location.gps" />
And I need to have it set as
<uses-feature
android:name="android.hardware.location.gps" android:required="false" />
When I was using phonegap adding edit-config instruction to config.xml did the job:
In Phonegap:
<edit-config file="AndroidManifest.xml" target="/manifest/uses-feature" mode="merge">
<uses-feature
android:name="android.hardware.location.gps"
android:required="false" />
</edit-config>
I tried Cordova CLI to build the APK and had to change it to
<edit-config file="AndroidManifest.xml" target="/*/uses-feature[@android:name='android.hardware.location.gps']" mode="merge">
<uses-feature
android:name="android.hardware.location.gps"
android:required="false" />
</edit-config>
But Cordova CLI is not as easy than VOLT and we would like to use it instead. I expected that the same edit-config instruction works. Unfortunately, it is not the case. I tried to change the value of target in several ways none of them works.
Keeping the same than Cordova CLI, I get the following error :
Unable to graft xml at selector "/manifest/uses-feature[@android:name='android.hardware.location.gps']" from "/platforms/android/app/src/main/AndroidManifest.xml" during config install
Going through the Cordova documentation, I do not find an alternative to have it done. Has someone an idea how to make it work ?
I successfully tested “edit-config” with the value below, so I know it can works but not (yet) for uses-feature tag:
<config-file target="AndroidManifest.xml" parent="/manifest">
<uses-sdk android:minSdkVersion="23" android:maxSdkVersion="28" />
</config-file>
Thanks in advance for your help.
Best Regards,
Michael O