Cordova plugin installation


I am trying to install a plugin in my Ionic app:

It is supposed to work with just the first two lines - adding the plugin and copying the library - then serial.requestPermission() etc… However, when I run the app on the device ‘serial’ is undefined and I can’t use it.

I’ve been trying to make this work for a while. No progress at all. Can someone help, pls?

when do you call serial.requestPermission()?

In the controller, after cordova.js is loaded.

I do ‘ionic run android’ and then try to print ‘serial’ or ‘’ on the device display, just to see if the ‘serial’ object exists.

I’m bumping this since there is no indication the OP ever solved his problem.
I found this link question/install · Issue #12 · xseignard/cordovarduino · GitHub
According to the link the poster eventually solved his problem.
I’m quoting the relevant text FFR.

The 'serial' is available in module -> .run(...$ionicPlatform.ready()...,which is the default config for a starting Ionic project. I did smthg like document.write( in that scope and missed it:), but with an alert(), on the device, it was visible. Then injected $rootScope and attached the object to it so it can be used from the controllers. Not sure if the $rootScope part is a good solution, but I am happy with it right now.

Handy info to have.