Hi guys,
For those that stumble upon this trying to get ‘non native’ Cordova plugins working, here is some advice I found that helped me when trying to get the Scandit barcode scanner working but I think it applies to plugins in general.
Check the plugin.xml
file in the root of the plugin’s directory, e.g. /plugins/com.mirasense.scanditsdk.plugin/plugin.xml
, here you will find <clobbers>
elements which will indicates the namespace for exported modules of the plugin. Looking at these you can work out how to reference the plugin within your app.
For example, the License module of the Scandit plugin has the following namespace:
<clobbers target="Scandit.License"/>
I was able to reference and use it in my code by declaring and using it directly, like so:
...
import { Platform } from 'ionic-angular'
declare var Scandit;
@Component({
...
scan() {
this.platform.ready().then(() => {
Scandit.License.setAppKey("...");
...
This unfortunately doesn’t work for the development server though, brings up reference errors, but it should work on a device.