Tactile feedback

There are two types of cases where vibration or audio of the device is used as an output method when the user is interacting with the device touch screen:

  • When the user has touched an active area of the screen, and an action will be triggered on touch release

  • Interaction with given components has been successful

As with sounds, tactile feedback must be used carefully so as not to desensitize the user to the vibration: the attention grabbing quality remains and functions so long as the feedback is not too frequent.

Tactile feedback is included in those common UI components, where seen as beneficial. When new components are designed, tactile feedback is to be included in those if seen beneficial usability-wise. For example, in any button type of UI component the tactile feedback is natural. Application can disable tactile feedback from the common UI components it uses, if seen necessary. This is acceptable only in cases, where tactile feedback would cause interference, like during a phone call or when giving audio commands to the system.

The user can choose whether tactile feedback is on or off.

Characteristics of haptics related APIs

You can use the following APIs to create haptic effects:

  • Tactile Feedback Client API

    • available from S60 5.0 onwards

    • can be used on all S60 5.0 or later mobile devices but the feedback is played only on touch enabled layouts

    • provides simple functions for triggering various predefined tactile feedback (vibration or audio) effects

    • enables a consistent user experience in all applications of the mobile device (an application gives a logical feedback type as an input and the actual physical effect depends on the mobile device configuration and end user settings)

    • when the area feedback is used, latency is the smallest for the feedback triggering (tactile feedback can be triggered at the window server level before the corresponding pointer event is delivered to the visible application)

    • direct feedback is easy to integrate into HandlePointerEventL code

    • an application can select the logical tactile feedback from certain types and the produced effect may be different on various mobile devices

  • Vibra API

    • available from S60 3.0 onwards

    • can be used for running device vibrator with given intensity for given period of time

    • a privileged client application can use this for playing pulse effects which have a really short duration (as the ones used for tactile feedback)

When to use Tactile Feedback Client API and Vibra API

You should use
  • Tactile Feedback Client API for providing tactile feedback in custom controls (grids, lists, etc.) which comply with the style of the Core UI components to ensure a uniform user experience among applications

  • Vibra API to produce haptic effects such as ringing tone vibration

Using tactile feedback in C++ applications

The API to use for tactile feedback is the Tactile feedback client API.

The S60 platform includes a tactile feedback interface to add, modify and remove feedback areas in the registry. There is also an option to trigger direct feedback and bypass the registry. MTouchFeedback::Instance() is used for acquiring a pointer to a touch feedback instance. When touch feedback is activated, the mobile device users get a slight vibration when the control with the feedback interface is touched.

Note: Tactile feedback can be set be disabled in a client application or a mobile device in some situations, for example, during phone calls.

Client applications cannot determine the actual physical feedback that is generated. It depends on device configuration and current settings. In current devices, the user changeable settings include vibration and audio feedback intensity level.

In your application, you can use the following feedback types, defined in TTouchLogicalFeedback:

ETouchFeedbackNone

Use for disabling feedback for some areas of the application window when using the area registry.

ETouchFeedbackBasic

Use as default feedback for stylus down events, for example, when the mobile device user taps a button or tab.

ETouchFeedbackSensitive

Sensitive feedback for situations where the triggering action is not very important (e.g. change of focus in a list), or when there can be a large number of feedback instances within a short time (e.g. text selection which gives feedback on every new selected character). Also used for scrolling and dragging.

To use vibration or audio feedback in your application:

  1. Include touchfeedback.lib in your .mmp file.

  2. Include touchfeedback.h.

  3. To enable tactile feedback for your application, add the following code.

    MTouchFeedback* feedback = MTouchFeedback::Instance();
    feedback->SetFeedbackEnabledForThisApp(ETrue); // enabling feedback is optional  

    Do not delete the pointer in the controller destructor.

  4. To use tactile feedback when a mobile device user points at a control, add the following code.

    void CMyContainerControl::HandlePointerEventL(const TPointerEvent& aPointerEvent)
        {
        // Feedback is always played at pointer down event
        if(aPointerEvent.iType == TPointerEvent::EButton1Down)
            {
            MTouchFeedback* feedback = MTouchFeedback::Instance();  
            if (feedback) 
                 { 
                 feedback->InstantFeedback(ETouchFeedbackBasic);  
                 }  
            }
       
        // Your other pointer event handling code here
    
  5. To enable automatic feedback triggering in a specific area of a UI component, add

    feedback->SetFeedbackArea(this, 
                                  1, // area Id
                                  TRect(0,0,20,20), 
                                  ETouchFeedbackBasic, 
                                  ETouchEventStylusDown);
    

Note: Using tactile feedback does not require additional platform security capabilities for your application.