Ionic 3 : How to use cordova plugins

Viewed 13756

I'm trying to use this cordova plugin https://github.com/litehelpers/Cordova-sqlcipher-adapter.

Here my code :

...
import { Platform } from 'ionic-angular';

declare var cordova;

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

  constructor(platform: Platform) {
    platform.ready().then(() => {
      alert(cordova.plugins.sqlitePlugin);
    });
  }

The problem is, what-ever I do, sqlitePlugin is always undefined :/ However cordova.plugins is an object.

I also tried alert((<any>window).plugins.sqlitePlugin); but the result is the same.

I'm running in an Nexus 5X Android 8 device.

I have installed the plugin this way : ionic cordova plugin add cordova-sqlcipher-adapter --save as a standard cordova plugin.

Any helps would be appreciate :)

3 Answers

It's work for me

window["pluginName"].pluginFunction
Related