×
Namespaces

Variants
Actions

How to get notification of profile change

From Nokia Developer 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 06:11.
53 page views in the last 30 days.
×