Enabling
and Disabling a Feature
How to enable and disable a feature using RFeatureControl.
A feature is any
item of functionality which can be included in a phone build or excluded from
it. To enable and disable a feature using RFeatureControl,
take the following steps.
Create an instance of RFeatureControl,
// replace <featureUID> with a real Uid )
#include <featurecontrol.h>
#include <featureinfo.h> // for feature definitions
CMyClass::MyMethodL()
{
// Replace KFeatureUidx with real feature Uid.
// Open() must be called before calling any other methods.
// Disconnect is done by calling the Close() method.
RFeatureControl featureControl;
call its Open() function,
TInt err = featureControl.Open();
determine the Uid of the feature you wish to enable or disable,
call the EnableFeature() or DisableFeature() function
of the RFeatureControl object with the Uid of the feature
as argument, and
if ( err == KErrNone )
{
// Enable some feature.
// EnableFeature() and DisableFeature() methods return
// KErrNone if the feature was succesfully enabled or disabled,
// KErrAccessDenied if the feature is not modifiable.
// KErrPermissionDenied a capability check fails,
// KErrNotFound if the feature does not exist and
// otherwise one of the Symbian error codes.
err = featureControl.EnableFeature( <featureUID> );
call the Close() function of the RFeatureControl object.
// Remember to call CloseL after using RFeatureControl.
// It disconnects the Feature Manager server.
featureControl.Close();
}
}
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.