How to use vanilla Cordova plugin


#1

Hey!

How do i use a Cordova plugin in an ionicv3 (angular) project?
There’s no ionic-native wrapper for this plugin i’m going to use.

Said pluigin: Cordova smartconfig


#2

At the top of your Page or service you want to access it from you just need to declare it.

declare var espSmartconfig: any;

Obviously you won’t get intellisense but you will be able to use it.


#3

Hi, I’m a friend of @Realfsen and I’m looking into how to use the Cordova smart config together with Ionic.

Tried to add the declare var espSmartconfig: any; (as suggested by @Judgewest2000), but does not seem like that is enough.

When trying to access the library methods I get the error: 2018-11-19 13:14:26.477 14991-14991/io.ionic.starter D/SystemWebChromeClient: ng:///AppModule/HomePage.ngfactory.js: Line 118 : ERROR CONTEXT.

Here is the Logcat dump from when I try to access the library.

2018-11-19 13:14:26.475 14991-14991/io.ionic.starter D/SystemWebChromeClient: http://localhost:8080/build/main.js: Line 79 : ESP:Configuring...
2018-11-19 13:14:26.476 14991-14991/io.ionic.starter I/chromium: [INFO:CONSOLE(79)] "ESP:Configuring...", source: http://localhost:8080/build/main.js (79)
2018-11-19 13:14:26.476 14991-14991/io.ionic.starter D/SystemWebChromeClient: ng:///AppModule/HomePage.ngfactory.js: Line 118 : ERROR
2018-11-19 13:14:26.476 14991-14991/io.ionic.starter I/chromium: [INFO:CONSOLE(118)] "ERROR", source: ng:///AppModule/HomePage.ngfactory.js (118)
2018-11-19 13:14:26.477 14991-14991/io.ionic.starter D/SystemWebChromeClient: ng:///AppModule/HomePage.ngfactory.js: Line 118 : ERROR CONTEXT
2018-11-19 13:14:26.477 14991-14991/io.ionic.starter I/chromium: [INFO:CONSOLE(118)] "ERROR CONTEXT", source: ng:///AppModule/HomePage.ngfactory.js (118)

And here is a github repo of my test-implementation: https://github.com/SjoenH/EspSmartConfig

Is there any other place I have to import / export etc the library to get access?

Best regards, Henry


#4

Hi,

Following the install instructions of the git repo I can’t get it working on my device.

I don’t know it well enough to help I’m afraid.

Tried setting up a brand new regular app and adding the plugin, but nothing coming up on my Android device.


#5

Hey, thanks for trying man. Appreciate the effort!