Namespaces

Variants
Actions

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.

How to get notification of profile change

From Wiki
Jump to: navigation, search
Article Metadata
Code ExampleArticle
Created: kiranmudiyam (02 Aug 2007)
Last edited: hamishwillee (26 Jul 2012)
Profiles Engine API, part of the Extension plug-in package for Symbian 3rd Edition, MR, provides a class CProfileChangeNotifyHandler using which we can get a notification for activation of a new profile and modifications of current active profile settings.

Header files

#include <CProfileChangeNotifyHandler.h>
#include <MProfileChangeObserver.h>

Libraries used

profileeng.lib

Example code :

MProfileChangeObserver.h provides an abstract interface class MProfileChangeObserver for handling the active profile events. You have to derive your class from this and implement pure virtual class HandleActiveProfileEventL() to get notifications.

You have to instantiate CProfileChangeNotifyHandler class in the ConstructL of your class:

iHandler = CProfileChangeNotifyHandler::NewL( this );

HandleActiveProfileEventL() is a callback function which is called when an active profile event completes:

void CNotifyEngine::HandleActiveProfileEventL(
TProfileEvent aProfileEvent,
TInt aProfileId )
{
// handle event
TBuf<30> msg(_L("Current Profile Id : "));
msg.AppendNum(aProfileId);
 
switch(aProfileEvent)
{
case EProfileNewActiveProfile:
{
// New profile is activated
CEikonEnv::InfoWinL(_L("New Active Profile"),msg);
break;
}
case EProfileActiveProfileModified:
{
// Active profile settings are modified
CEikonEnv::InfoWinL(_L("Active Profile Modified "),msg);
break;
}
case EProfileUnknownEvent:
{
CEikonEnv::InfoWinL(_L("Unknown Event"),msg);
break;
}
}
}

Profile Ids and name of the profile :

0 General
1 Silent
2 Meeting
3 Outdoor
4 Pager
5 Offline
6-31 User defined profiles

Example project :

File:NotifyProfileChange SampleCode.zip


Related Links:

This page was last modified on 26 July 2012, at 03:11.
34 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.

×