The 2017 Ionic Developer Survey Results are in!

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
    
  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