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

From Wiki
Jump to: navigation, search
Article Metadata
Created: User:Nobody (27 Feb 2007)
Last edited: hamishwillee (26 Jul 2012)

There's a CenRep key KCoreAppUIsNetworkConnectionAllowed that can be used for detecting off-line mode.

#include <CoreApplicationUIsSDKCRKeys.h>

To ask one time:

  TInt aOfflineModeOff(0);
// 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
delete repository;
You might want to order notifications about the changes:
iRepository = CRepository::NewL(KCRUidCoreApplicationUIs);
iCenRepNotifyHandler =
CCenRepNotifyHandler::NewL(*this, *iRepository,
CCenRepNotifyHandler::EIntKey, KCoreAppUIsNetworkConnectionAllowed);
void CThisClass::HandleNotifyInt(
TUint32 aId,
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:

#include <proengfactory.h>
#include <mproengengine.h>
MProEngEngine* engine = ProEngFactory::NewEngineLC();
TInt profileId = engine->ActiveProfileId();
if (profileId == 5) //offline
CleanupStack::PopAndDestroy(); //engine

Internal Links

How to Detect Offline Mode in 3rd Edition

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