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.
Launching the correct viewer app on Symbian
Launching the correct viewer application
If a file (content) type is supported in the device, the correct viewer for it can be launched as an embedded application with the CDocumentHandler class as follows:
#include <DocumentHandler.h> // link against commonui.lib
#include <apmstd.h> // link against apmime.lib
void TTestEmbedApp::EmbedLaunchFileL( const TDesC& aFile )
// iDocHandler is a pointer to CDocumentHandler
if( !iDocHandler )
// On S60 3rd Edition, CDocumentHandler constructor no longer requires
// a CEikProcess pointer as a parameter
iDocHandler = CDocumentHandler::NewL();
iDocHandler = CDocumentHandler::NewL( iEikonEnv->Process() );
iDocHandler->OpenFileEmbeddedL( aFile, empty );
This will launch the correct application to display the specified file. Because an empty data (MIME) type is used, document handler tries to resolve the data type automatically by passing the file to system recognizers. For example, if the file (aFile) is a .txt file, the Notes application will be launched. If the file is a .jpg file, Gallery/Image Viewer will be launched.