cordova-keyguard-plugin

Cordova keyguard plugin

Usage no npm install needed!

<script type="module">
  import cordovaKeyguardPlugin from 'https://cdn.skypack.dev/cordova-keyguard-plugin';
</script>

README

KeyGuardPlugin

Cordova keyguard plugin

Installation

If using cordova-cli 5.0 or newer:

cordova plugin add cordova-keyguard-plugin

for older versions:

cordova plugin add https://github.com/vstirbu/cordova-keyguard-plugin.git

JavaScript API

The plugin exposes the keyguard state for the application as navigator.keyguard object.

Reading the keyguard state

navigator.keyguard;

Changing the keyguard state

To activate the keyguard use the following:

navigator.keyguard = true;

To deactivate the keyguard use the following:

navigator.keyguard = false;

keyguard event

The plugin emits keyguard events whenever the state change has completed. You can reister for this events:

window.addEventListener('keyguard', function (state) {
  // state can be true or false;
});

Suported platforms

  • Android

License

The plugin is available under MIT license.