How to detect if a Symbian device is in offline mode
This article shows how to detect whether a Symbian device is in "offline" mode by querying the device profile.
Article Metadata
Headers Required:
#include <centralrepository.h>
#include <ProfileEngineSDKCRKeys.h>
Library needed:
LIBRARY centralrepository.lib
We need to Query Central Repository.
CRepository* cRepository = CRepository::NewLC( KCRUidProfileEngine );
CurrentProfileId will be used to hold the current active profile id.
TInt CurrentProfileId;
Get current profile Id.
//KProEngActiveProfile is the id of the currently active profile.
User::LeaveIfError( cRepository->Get( KProEngActiveProfile, CurrentProfileId ) );
Check CurrentProfileId to determine the active profile.
Possible values of CurrentProfileId can be one of the following:
- 0 = General profile (default value)
- 1 = Silent profile
- 2 = Meeting profile
- 3 = Outdoor profile
- 4 = Pager profile
- 5 = Off-line profile
- 6 = Drive profile
- 30-49 = User-created profiles
if ( CurrentProfileId == 5 )
{
// It means that the current profile is in the offline mode.
// Similarly you can check for any active profile by comparing the
// CurrentProfileId.
}
Internal Links:


06 Sep
2009
Very useful tip on how to detect offline mode for 3rd edition devices. It has many use cases like not trying to send SMS or providing any such options to the user in the Offline Mode. The code snippet can be used in identifying the current profile of the device also.