Ionic 3: How to use cordova plugins
I am trying to use this Cordova plugin https://github.com/litehelpers/Cordova-sqlcipher-adapter .
Here is 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 that whatever I do is sqlitePlugin
always undefined
: / However cordova.plugins
is an object.
I have also tried alert((<any>window).plugins.sqlitePlugin);
but the result is the same.
I am working on a Nexus 5X Android 8 device.
I installed the plugin like this: ionic cordova plugin add cordova-sqlcipher-adapter --save
as a standard cordova plugin.
Any help would be appreciated :)
+10
source to share
4 answers