How to use non native plugins on Ionic?

If you’re unhappy with the performance or format support of the BarcodeScanner, before resorting to something as complicated as this “Scandit” seems to be, I would first suggest trying out ZBar.

My use case was just scanning a product barcode and then looking it up in a list products so the BarcodeScanner worked well. Wasn’t aware of ZBar at the time, thanks for the tip @rapropos.

When you declare the Scandit variable in your component it allows you to access the plugin class and all it’s members from that component, see the other posts above, that’s where I got the idea from originally.

Thank you very much … this worked for me … I was trying to use Exoplayer https://github.com/frontyard/cordova-plugin-exoplayer plugin in ionic 2 project.

I checked the plugin.xml file under the directory

plugins/cordova-plugin-exoplayer/plugin.xml

Found below lines in plugin.xml:

Added the variable as below in my page:

import { Component } from ‘@angular/core’;
import { NavController } from ‘ionic-angular’;

declare var ExoPlayer : any;

@Component({
selector: ‘page-home’,
templateUrl: ‘home.html’
})
export class HomePage {

constructor(public navCtrl: NavController) {

}

ionViewDidLoad() {

let successCallback = function (json) {
};

let errorCallback = function (error) {
};

let params = {
  url: "http://www.youtube.com/api/manifest/dash/id/bf5bb2419360daf1/source/youtube?as=fmp4_audio_clear,fmp4_sd_hd_clear&sparams=ip,ipbits,expire,source,id,as&ip=0.0.0.0&ipbits=0&expire=19000000000&signature=51AF5F39AB0CEC3E5497CD9C900EBFEAECCCB5C7.8506521BFC350652163895D4C26DEE124209AA9E&key=ik0"
};

ExoPlayer.show(params, successCallback, errorCallback);

}

}

And it worked perfectly

Thanks again for the advice :slight_smile:

Note: it works on device or emulator … but I tried it in browser (using ionic run browser) but it did not work

@moama71 no worries, glad to have helped :slight_smile:

I’m still trying to get WifiWizard working but I cannot call any method on this object. I’ve installed it and tried different things (changing package.json and so on) but with no positive result. Can you help?

Hello, I’m trying to import noxa ionic3, and I’m not successful.
I realize that the plugin I am trying to import does not exist anything about will this be the problem?
Follow the plugin, thank you.

this is a guide to how plugin gets created pulgin creation
If you get to know how it is built you can easily use it without any doubt

SIDE NOTE
you can declare something like to remove some compile errors
declare var window : { <your plugin name that you specified in plugin.xml -> clobber->target> : any }

this worked for me
basically, you have to know how it works to use it
see how it is configured and used do the same thing with whichever plugin you are using

Hi All,

I have been looking to use cordova plugin which was not exposed via ionic-native wrapper. I found following command “console.dir(window)”, I used this to dump complete window object and found that some plugins are at (<any>window).plugin, some are at (<any>window).plugins, some are at (<any>window).cordova

I recommend dumping the window object for finding plugin path and then calling functions via proper object structure. It worked for me.

1 Like

This worked me, thanks!

ionic info:

@ionic/cli-utils : 1.19.2
ionic (Ionic CLI) : 3.20.0
global packages:
cordova (Cordova CLI) : 7.1.0
local packages:
@ionic/app-scripts : 3.1.8
Cordova Platforms : android 7.1.0 browser 5.0.3 ios 4.5.4
Ionic Framework : ionic-angular 3.9.2
System:
Android SDK Tools : 26.1.1
ios-deploy : 1.9.2
ios-sim : 6.1.2
Node : v9.8.0
npm : 5.8.0
OS : macOS High Sierra
Xcode : Xcode 9.3 Build version 9E145
Environment Variables:
ANDROID_HOME : /Users/**/Library/Android/sdk
Misc:
backend : pro

No worries! :slight_smile:

Is it working ? I am trying to work with ionic 3 , and I am not able to even import, I dont get what is the issue

Have you update wifiwizard & How have you updated That