I'm using a custom cordova plugin (https://github.com/VJAI/simple-crypto), not available in ionic native.
I'm using Ionic 2 and have installed the plugin using the command:
cordova plugin add https://github.com/VJAI/simple-crypto
The interface is like this:
var rncryptor = cordova.require("com.disusered.simplecrypto.SimpleCrypto");
rncryptor.encrypt(key, data, successCallback, failureCallback)
rncryptor.decrypt(key, data, successCallback, failureCallback)`
Method 1:
I have tried to invoke the plugin using
window.plugins.SimpleCrypto.encrypt(...)
But when I run ionic serve
, i get the error:
TypeError: Cannot read property 'SimpleCrypto' of undefined
Method 2:
Another way i tried was
cordova.plugins.SimpleCrypto.encrypt(...)
The error i got was
ReferenceError: cordova is not defined
Is there any way to go around doing this?
Have you tried to use
cordova.plugins.SimpleCrypto.encrypt
function on your device?
It is working for my case. The reason being, the emulator is unable to run cordova.js
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