| ID | TSS000037 | Creation date | March 4, 2003 |
| Platform | S60 1st Edition S60 2nd Edition | Devices | |
| Category | Symbian C++ | Subcategory | Multimedia |
| Keywords (APIs, classes, methods, functions): |
How can I add the camera view to an application, such as the Insert->New Image option in the Messaging Application?
The following code lines demonstrate how to embed the camera application within an application. Besides the function that starts the camera application, MApaEmbeddedDocObserver::NotifyExit() must be implemented. It is called when the user has exited the camera application.
void MyApplication::NewImage()
{
const TUid KUidCamera = { 0x1000593F };
RApaLsSession apaLs;
TApaAppInfo appInfo;
CApaDocument* doc = NULL;
CEikProcess* process = CEikonEnv::Static()->Process();
User::LeaveIfError(apaLs.Connect());
CleanupClosePushL(apaLs);
User::LeaveIfError(apaLs.GetAppInfo(appInfo, KUidCamera));
doc = process->AddNewDocumentL(appInfo.iCaption, KUidCamera);
CleanupStack::PopAndDestroy(); // apaLs
TApaDocCleanupItem cleanup(process, doc);
CleanupStack::PushL(cleanup);
doc->NewDocumentL();
CleanupStack::Pop(); // cleanup
doc->EditL(this, ETrue);
}
void MyApplication::NotifyExit(TExitMode aMode)
{
// camera view has been closed
}