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 check if the phone is in offline mode
There's a CenRep key KCoreAppUIsNetworkConnectionAllowed that can be used for detecting off-line mode.
To ask one time:
// Connecting and initialization:
CRepository* repository = CRepository::NewL(KCRUidCoreApplicationUIs);
// Check offline mode on or not.
if (repository->Get(KCoreAppUIsNetworkConnectionAllowed, aOfflineModeOff) == KErrNone)
// Do something based on the aOfflineModeOff value
You might want to order notifications about the changes:
iRepository = CRepository::NewL(KCRUidCoreApplicationUIs);
TInt aNewValue )
if (aId == KCoreAppUIsNetworkConnectionAllowed)
// Do something based on the aNewValue
// Remeber to delete created objects in the destructor
S60 3rd, FP1
Another way to query the profile is to use the Profiles Engine Wrapper API:
MProEngEngine* engine = ProEngFactory::NewEngineLC();
TInt profileId = engine->ActiveProfileId();
if (profileId == 5) //offline