I want to give the user a haptics feedback when he/she touches a specific location on screen, bounded by x and y coordinates like a rectangle, something like this:
if (x > 050
&& x < 100
&& y > 50
&& y < 100) {
// do some code
//then enter haptics feedback
}
the only way I got is to add haptics to certain views like buttons, is it applicable on a general touch event??
thanks in advance
You can utilize the vibrator system service at any given time. Small sample that could go into the
ifblock of your question (vibrates for 500ms):ctxis a context instance hereBut don’t forget to add the relevant permission into the manifest: