How to to include 'edit-config' tag in mobile-config.js?


#1

I need to include the following in the Cordova’s config.xml to request access to device Microphone.

<edit-config target="NSMicrophoneUsageDescription" file="*-Info.plist" mode="merge">
    <string>need microphone access to record sounds</string>
</edit-config>

How is edit-config tag maintained by using Meteor mobile-config.js?


#3

App.appendToConfig(` <edit-config target="NSMicrophoneUsageDescription" file="*-Info.plist" mode="merge"> <string>need microphone access to record sounds</string> </edit-config> `);


#4

Thank you for your suggestion but it doesn’t work and throwing the following error;

While preparing Cordova project for platform iOS: TypeError: doc.find is not a function at Object.resolveParent (/Users/gokhanmb/.meteor/packages/meteor-tool/.1.6.0_1.flmk1s.ontdr++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/cordova-lib/node_modules/cordova-common/src/util/xml-helpers.js:209:26)


#5

NSLocationWhenInUseUsageDescription works in my project (Meteor 1.6.1). Please check that you include backtick symbol before <edit-config> and after </edit-config>

App.appendToConfig(` <edit-config target="NSLocationWhenInUseUsageDescription" file="*-Info.plist" mode="merge"> <string>need location... </string> </edit-config> `);


#7

Yes, you are right. I try your code and it works. But when I change the target from NSLocationWhenInUseUsageDescription to NSMicrophoneUsageDescription it fails :grimacing::grimacing::grimacing:


#8

Oh, finally it works with the following;


App.appendToConfig(`
  <edit-config target="NSMicrophoneUsageDescription" file="*-Info.plist" mode="merge">
    <string>Need microphone access to record voice</string>
  </edit-config>
`);

Thank you!