Search code examples
cordovaionic-frameworkcordova-plugins

How to use non native cordova plugins in ionic 4


I am trying to use this plugin in my Ionic 4 app: https://github.com/IOCare/cordova-plugin-smartconfig

I installed plugin using ionic cordova plugin add https://github.com/IOCare/cordova-plugin-smartconfig.git and it seems to be added to project fine. Cordova plugin list shows: cordova-plugin-smartconfig 1.0.4 "Cordova Smart Config"

I have tried:

declare var espSmartConfig: any; and using espSmartConfig.startConfig()

and

declare var cordova: any; and using cordova.plugins.espSmartConfig.startConfig(),

and

declare var window: any; and using window.espSmartConfig.startConfig()

..but everything is unidentified. I have tried with Ionic DevApp on my android phone and with chrome on my PC.

I'm sure I'm missing something obvious, but I can't figure out what. All documents I've found are referring to native plugins.


Solution

  • As couple of you guys suggested I tried to build the App and run that on my phone. Worked like a charm with:

    declare var espSmartConfig: any;
    

    So the problem here was only my tools that I used to test the app.

    Thank you all for your input!