3
votes

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.

2
I have tried with Ionic DevApp on my android phone and with chrome on my PC. Ionic Dev app is a pre-built application that only contains a select set of Ionic Native plugins - you cannot install 3rd party plugins into it. Chrome is a browser and that plugin only supports native Android & iOS platforms. To use it you'll have to build your own native Android app using Cordova - see here - DaveAlden

2 Answers

1
votes
  1. First add the plugin using.

cordova plugin add https://github.com/IOCare/cordova-plugin-smartconfig.git

  1. Then in app.ts

declare var espSmartconfig;

  1. To start the config use this.

espSmartconfig.startConfig("ssid", "00:00:00:00","password", "NO", 1, function (res) { }, function (error) {console.log(error);});

  1. Remember to stop the config once done.

espSmartconfig.stopConfig(function (res) { console.log(res); }, function (error) {console.log(error);});

0
votes

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!