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 :)
A plugin is a package of injected code that allows the Cordova webview within which the app renders to communicate with the native platform on which it runs. Plugins provide access to device and platform functionality that is ordinarily unavailable to web-based apps.
After several hours, the correct way to use the plugin was : (<any>window).sqlitePlugin
Hope it could helps :)
It's work for me
window["pluginName"].pluginFunction
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With