Enable/Disable Vibration

Hi,
I build a simple counter app. I add a switch to my app. I want when someone turn the switch on then every time they click on a button the phone vibrates, and then the switch is off, the phone does not vibrate. How can I do that?

I found the solution. The fix is to add if statement

2 Likes