Ionic Shake error


#1

Hi guys, I tried using shake plugin for my app, the code i wrote(actually the code I saw on official documentation page) is

 const watch = this.shake.startWatch().subscribe(() => {
      alert('shake!');

    });
    watch.unsubscribe();

the error i keep getting is:

plugin.js:168 TypeError: Cannot read property ‘stopWatch’ of undefined

Can u help me see what am I missing here?


#2

I think you need to set timeout in startWatch function.
like this startWatch(100).


#3

Could you please provide links to the plugins you are using here? What is this.shake?


#4

Hi guys, sorry for the late response, the error i did get is because it can only be tested on real device, didn’t figure out until I tested it on device! :slight_smile:

Plugin i used is cordova-plugin-shake, sorry for bothering :slight_smile: