Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Monitoring Tactile Feedback Vibration Mode

From Wiki
Jump to: navigation, search

This Symbian C++ code snippet shows how to Monitor Touch Screen Vibration Mode Change.

Article Metadata
Code ExampleTested with
Devices(s): Nokia 5800 XpressMusic.
Platform(s): S60 5th Edition
S60 5th Edition
Platform Security
Signing Required: Self-Signed
Capabilities: None
Keywords: VibraFeedbackModeChanged(),MHWRMVibraFeedbackObserver ,Tactile Feedback Vibration Mode
Created: vasant21 (03 Nov 2008)
Last edited: hamishwillee (30 May 2013)



Here we assume that we already have a working application.

MMP file

The following capabilities and libraries are required:


LIBRARY HWRMVibraClient.lib

<STEP 1>

Whatever Client that needs to monitor Touch Screen Vibration should derive from the MHWRMVibraFeedbackObserver interface and implement the VibraFeedbackModeChanged() method.

#include <HWRMVibra.h> 
class CVibrationModeMonitorAppView : public CCoeControl, public MHWRMVibraFeedbackObserver
// from MHWRMVibraFeedbackObserver
virtual void VibraFeedbackModeChanged(CHWRMVibra::TVibraFeedbackModeState aMode);
* Owned
* CHWRMVibra instance

CHWRMVibra* iVibra;

<STEP 2>

Create CHWRMVibra instance and set CVibrationModeMonitorAppView as observer for notification of feedback setting change.

void CVibrationModeMonitorAppView::ConstructL(const TRect& aRect)
iVibra = CHWRMVibra::NewL();
// Set View as observer for notification of feedback setting change //

<STEP 3>

Implement VibraFeedbackModeChanged().

void CVibrationModeMonitorAppView::VibraFeedbackModeChanged(CHWRMVibra::TVibraFeedbackModeState aMode)
// Create new CAknGlobalNote instance.
CAknGlobalNote* globalNote = CAknGlobalNote::NewL();
// Push CAknGlobalNote's pointer to CleanupStack
CleanupStack::PushL( globalNote );
TBuf<KMaxMessageLen> message;
switch ( aMode )
case CHWRMVibra::EVibraFeedbackModeON:
message.Copy( KVibraModeOn );
globalNote->ShowNoteL( EAknGlobalInformationNote, message );
case CHWRMVibra::EVibraFeedbackModeOFF:
message.Copy( KVibraModeOff );
globalNote->ShowNoteL( EAknGlobalInformationNote, message );
// Pop and Destroy CAknGlobalNote's pointer from CleanupStack

<STEP 4>

Testing : For testing the Vibration Mode, run the attached application, keep the application running in the background and then try to enable/disable tactile feedback through Control Panel -> Personal -> Profiles -> <Profile_in_use> -> <Personalise> -> Touch Screen Tones.

After changing the status you will see the appropriate message on the profile screen itself, because we have used Global Notes in the example.


Appropriate Tactile Feedback Vibration Mode Status Events will be received by CVibrationModeMonitorAppView displaying notes with appropriate message.

Example Application

This page was last modified on 30 May 2013, at 04:34.
36 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.


Thank you!

We appreciate your feedback.