question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

using cordova-diagnostic-plugin modules with Ionic 4 + Capacitor

See original GitHub issue

The only details I can find around this issue is an unanswered question on the forum here.

The documentation for cordova-diagnostic-plugin says that you can add the following line to your config.xml to only import the modules you need from the diagnostic plugin:

<preference name="cordova.plugins.diagnostic.modules" value="[list of modules]" />

However unlike Cordova, Capacitor doesn’t have the equivalent config.xml file. If I modify the file ios/App/App/config.xml to remove the additional modules, they are automatically re-added when I re-run the npx cap copy/npx cap sync commands.

The issue with this is that I have to declare additional keys in my Info.plist file requesting permission for features I am not going to use (Bluetooth for example). Once I add the keys, my app gets rejected by Apple because I am requesting permissions to use Bluetooth in the background but my binary does not use Apple’s Bluetooth Module.

Does anyone have any ideas or suggestions on how to import selected modules only from the cordova-diagnostic-plugin when using Capacitor?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
samih-devcommented, Jul 21, 2020

I have managed to update it with the following steps:

  1. remove the plugin
  2. run npx cap sync: which will update the config file in the platform project
  3. install the plugin again - having a preference tag set to what modules I need
  4. run npx cap sync
3reactions
achhaibacommented, Dec 18, 2019

Create an empty config.xml file in the project root directory then add only the following line to it:

<preference name="cordova.plugins.diagnostic.modules" value="LOCATION" />

That work for me. config.xml.zip

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ionic 4 / Capacitor / Cordova - Diagnostic Plugin and config.xml
I am trying to use the Ionic Native/Cordova Diagnostic plugin with Capacitor. By default diagnostic installs a lot of modules that I don't ......
Read more >
Using Cordova Plugins and Ionic Native
When developing an app that uses Capacitor, it's possible to use both Cordova and Ionic Native plugins. Installing Cordova Plugins​. Simply install your...
Read more >
ionic Diagnostics Native Plugin not working on Capacitor
I'm trying to build APK. After I installed Diagnostics I get these errors. import android.
Read more >
Using the Ionic Native Diagnostics plugin
Enter the Ionic Native Diagnostics plugin which allows developers to detect whether a certain feature is enabled or even present on the device ......
Read more >
cordova.plugins.diagnostic
Start using cordova.plugins.diagnostic in your project by running `npm i cordova.plugins.diagnostic`. There are 7 other projects in the npm ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found