Friday, 20 September 2019

Ionic 3 Volume Key Event Capture

What I want to do is call one of my functions whenever the user presses the volume up or the volume down buttons on the phone. What I tried so far is using the cordova events, but without any success (nothing happens when I touch the buttons)

In app.component.ts:

this.platform.ready().then(() => {
  document.addEventListener("volumeupbutton", this.myFunc, false);
});

myFunc() {
  console.log("it's working");
} 



from Ionic 3 Volume Key Event Capture

No comments:

Post a Comment