Providing tactile feedback for user actions

Tactile feedback provides users with immediate confirmation that the touch event has been registered. It is especially useful in noisy environments. You can use vibration as tactile feedback on user actions. Tactile feedback is implemented for those common S60 UI components where it has been seen as beneficial. If you create custom components for widgets, consider providing tactile feedback for buttons, sliders, strokes, gestures, and notifications.

For general principles on providing tactile feedback, see Tactile feedback.

You use JavaScript SystemInfo Service API methods to provide tactile feedback. For more information, see Vibration information and control services.

To provide tactile feedback for user actions

  1. Check that vibration is enabled on a mobile device.

    if (sysinfo.vibrasettings==1)
    	startVibration();
    
  2. Specify settings for the intensity and duration of vibration. The following example specifies maximum intensity for maximum duration when users touch a UI component.

    function startVibration()
    {
       // get the system defined maximum duration
       var duration = sysinfo.vibramaxduration;
       // get the system defined minimum intensity
       var intensity = sysinfo.vibraminintensity
       // start vibration
       sysinfo.startvibra(duration, intensity);
    }

    You can also use the startvibra() method of the JavaScript SystemInfo Service API setting to specify the duration and intensity of vibration. For example:

    getSysInfo: function() {
    	if ( !WrtHelper._sysinfo ) {
    		WrtHelper._sysinfo = document.getElementById("sysinfo");
    	
    	}
    	
    	return WrtHelper._sysinfo;
    },
    
    tactileFeedback: function() {
    	var sysinfo = WrtHelper.getSysInfo();
    	if (sysinfo.startvibra) 
    		sysinfo.startvibra(10, 10);
    },