Need help upgrading to Ionic Framework 4.0? Get assistance with our Enterprise Migration Services EXPLORE NOW

Shake

Improve this doc

Handles shake gesture

Repo: https://github.com/leecrossley/cordova-plugin-shake

Installation

  1. Install the Cordova and Ionic Native plugins:
    $ ionic cordova plugin add cordova-plugin-shake
    $ npm install --save @ionic-native/shake@4
    
  2. Add this plugin to your app's module

Supported platforms

Usage

import { Shake } from '@ionic-native/shake';

constructor(private shake: Shake) { }

...

const watch = this.shake.startWatch(60).subscribe(() => {
  // do something
  });

watch.unsubscribe();

Instance Members

startWatch(sensitivity)

Watch for shake gesture

Param Type Details
sensitivity number

Optional sensitivity parameter. Defaults to 40

Returns: Observable<any>

API

Native

General