Search code examples
androidlocationproximityvibrationtouch-feedback

Haptic feedback proximity/location to user touch


Does android haptic feedback allow vibration to specifically occur at the area of a user's touch? For example, if there were four buttons north, south, east and west on an activity, could you get the vibration to feel like it's pinpointed directly to the user's finger at each button's point? The code below is an example that generates vibrations on button presses, however it's almost impossible to tell if this occurs at specific areas of the device. If there is a way to vibrate the device at specific areas (maybe it could be done at device specific co-ordinates?), how would this be implemented?

public class Haptics extends Activity implements OnClickListener {

    private View myView;
    private Vibrator myVib;

    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_haptics);
        myVib = (Vibrator) this.getSystemService(VIBRATOR_SERVICE);
        myView = (View) this.findViewById(R.id.northButton);
        myView.setOnClickListener(this);

        myView = (View) this.findViewById(R.id.eastButton);
        myView.setOnClickListener(this);

        myView = (View) this.findViewById(R.id.southButton);
        myView.setOnClickListener(this);

        myView = (View) this.findViewById(R.id.westButton);
        myView.setOnClickListener(this);
    }

    @Override
    public void onClick(View v)
    {
        myVib.vibrate(50);
    }
}

Solution

  • As far as I know, the vibration is something that occurs for the entire physical device. I don't know of a device which can localize this. If so, it would be a very specific device vendor.

    Touchscreens work very differently than vibration mechanisms. You can pinpoint the source of a touch/tap, etc.. but vibrations do not work in this way.

    You can use a nice library for a variety of haptic (vibration) effects, so that each button can launch a different effect.

    Try it - free: Immersion Haptic SDK