You can embed an application as follows: - You have to identify the host application whose content the embedded application will be running in, - You have to create (actually add) a new document to the host application, - You have to call the newly added doc's EditL method in order to create an app ui (among other things), - Finally an optional thing: you may pass a filename to the doc.
How does it look like in practice?
Code:
/* Launch the appropriate application in embedded mode */ CEikProcess* hostProcess = CEikonEnv::Static()->Process();
I've managed to start the application embedded but only when i am passing NULL to the newDoc->EditL()
I need my application to detect that the embedded application has exited, and i'm not having success to pass an Observer to do that.
I've already derived a class from MApaEmbeddedDocObserver with the NotifyExit method implemented and created an instance and passed that to the EditL with no success
I've try too derive my CEikDocument class from MApaEmbeddedDocObserver like this:
Quote
class CMyProgDocument : public CEikDocument, public MApaEmbeddedDocObserver
And inside my Document class i called newDoc->EditL(this,ETrue) and with no success either.
What i want is that my application exits imediatly after the embedded application exits.
Help please, i don't know if i am making some very newbie mistakes, i am new to Symbian.
That's interesting. We use a simple CBase-derived object (not a CEikDocument) that additionally implements MApaEmbeddedDocObserver mixin as well. And everything works fine.
We call EditL like this:
Code:
iDoc->EditL( this, ETrue ); // "This" acts as observer.
where "this" is certainly the object I was talking about above.
Anyway, first, this is the right way to be notified upon exit, but there're two things I still think good to know. 1.) DestroyDocument: I forgot to mention one thing. When the embedded application exists, it most probably does it so that only its app ui gets deleted and of course, all those objects that are owned (implicitly or explicitly) by the app ui. So the document object itself will NOT be deleted and thus, you have to do it yourself. You can do it like this:
where iDoc is the same document that you've got when you called AddNewDocumentL method.
2.) Maybe there's another way for you to be notified when the embedded application exits. You know, when this happens the embedded app ui losts the focus and your app ui gets it. It happens via HandleForeground method of your app ui. It might be worth do some experiments how this works. The point is that your app ui's HandleForeground method gets called when it gets the focus back from the embedded app ui. So here you have another chance to detect this event.
2.) Maybe there's another way for you to be notified when the embedded application exits. You know, when this happens the embedded app ui losts the focus and your app ui gets it. It happens via HandleForeground method of your app ui. It might be worth do some experiments how this works. The point is that your app ui's HandleForeground method gets called when it gets the focus back from the embedded app ui. So here you have another chance to detect this event.
Cheers,
tOtE
Hi Tote
First let me thank you for all your great help
I have managed to detect the exit of the embedded application in the HandleForegroundEventL and put the code to destroy the document there.
Now i have yet another problem
My Application is launched by MCE (in embedded mode of course) and like you see inside my application i'm launching another appliction in embedded mode, when that application exits i need to close my application, what i did was to put Exit(); in the HandleForegoundEvenL but when the application i am calling closes i am getting an error in MCE and it closes too. I tried to put User::Exit(0); and it gives me no errors but that way the MCE closes and i don't want it to close
If for exemple i replace my code to launch the embedded application with something like displaying an information note everything works ok with the Exit(); function.
Am i missing something, maybe some object to destroy?
So, when the embedded application is exiting (the application you launched embedded into your app) it crashes? Is it possible that the embedded application is buggy? What is the call stack, anyway?
So, when the embedded application is exiting (the application you launched embedded into your app) it crashes? Is it possible that the embedded application is buggy? What is the call stack, anyway?
tOtE
What crashes is the MCE that called my application because my application is associated with a mime type.
I still don't know which application is crashing, sorry.
When an embedded application is exiting, its HandleForegroundL method is called with EFalse. After this, the embedding application's HandleForegroundL method will also be called with ETrue. I would like to know if your application's HandleForeground is called or not when it is getting back the control (from the closing embedded app).
Actually we've had a serious problem with issuing an Exit(); at the end of our app's HandleForegroundL method, but it was a really exceptional case: we delayed the Exit with an active object (so that the Exit() method was in fact called inside an AO's RunL method) and when Exit was being executed it crashed the whole application chain. I don't want to bore you with the details, because people usually don't overellaborate their applications like this and thus, you most likely have a different kind of problem.
My embedded application runs for the first time perfectly and when closes, I make sure to delete the view and the document. However, when launches for the second time, it gives a panic CONE 32.
When tracing, it seems happen in the BaseConstructL called from inside the ConstructL of my app UI.
Re: How to invoke an application in embedded mode?
In this embedded application case, who is actually responsible for the capabilities of the Embedded app?
Is it the responsibility of Host application to take care of the security for embedded application or does it required to be done by the Embedded application itself?
Forum posts: 723
You can embed an application as follows:
- You have to identify the host application whose content the embedded application will be running in,
- You have to create (actually add) a new document to the host application,
- You have to call the newly added doc's EditL method in order to create an app ui (among other things),
- Finally an optional thing: you may pass a filename to the doc.
How does it look like in practice?
CEikProcess* hostProcess = CEikonEnv::Static()->Process();
CEikDocument* newDoc = (CEikDocument*)hostProcess->AddNewDocumentL(
_L("Z:\\system\\apps\\xxx\\xxx.app"), xxxUID );
newDoc->EditL( this, ETrue ); // "This" acts as observer.
RFs fs;
User::LeaveIfError( fs.Connect() );
CleanupClosePushL<RFs>( fs );
newDoc->OpenFileL( ETrue, _L("A file name"), fs );
CleanupStack::PopAndDestroy(); // close fs
Cheers,
tOtE
Gabor Torok
Software architect, Agil Eight (http://www.agileight.com/)
Blog: http://mobile-thoughts.blogspot.com/
Forum posts: 14
I've managed to start the application embedded but only when i am passing NULL to the newDoc->EditL()
I need my application to detect that the embedded application has exited, and i'm not having success to pass an Observer to do that.
I've already derived a class from MApaEmbeddedDocObserver with the NotifyExit method implemented and created an instance and passed that to the EditL with no success
I've try too derive my CEikDocument class from MApaEmbeddedDocObserver like this:
And inside my Document class i called newDoc->EditL(this,ETrue) and with no success either.
What i want is that my application exits imediatly after the embedded application exits.
Help please, i don't know if i am making some very newbie mistakes, i am new to Symbian.
Forum posts: 723
That's interesting.
We call EditL like this:
where "this" is certainly the object I was talking about above.
Anyway, first, this is the right way to be notified upon exit, but there're two things I still think good to know.
1.) DestroyDocument: I forgot to mention one thing. When the embedded application exists, it most probably does it so that only its app ui gets deleted and of course, all those objects that are owned (implicitly or explicitly) by the app ui. So the document object itself will NOT be deleted and thus, you have to do it yourself. You can do it like this:
{
CEikProcess* hostProcess = CEikonEnv::Static()->Process();
hostProcess->DestroyDocument(iDoc);
iDoc = NULL;
}
where iDoc is the same document that you've got when you called AddNewDocumentL method.
2.) Maybe there's another way for you to be notified when the embedded application exits. You know, when this happens the embedded app ui losts the focus and your app ui gets it. It happens via HandleForeground method of your app ui. It might be worth do some experiments how this works. The point is that your app ui's HandleForeground method gets called when it gets the focus back from the embedded app ui. So here you have another chance to detect this event.
Cheers,
tOtE
Gabor Torok
Software architect, Agil Eight (http://www.agileight.com/)
Blog: http://mobile-thoughts.blogspot.com/
Forum posts: 14
Cheers,
tOtE
Hi Tote
First let me thank you for all your great help
I have managed to detect the exit of the embedded application in the HandleForegroundEventL and put the code to destroy the document there.
Now i have yet another problem
My Application is launched by MCE (in embedded mode of course) and like you see inside my application i'm launching another appliction in embedded mode, when that application exits i need to close my application, what i did was to put Exit(); in the HandleForegoundEvenL but when the application i am calling closes i am getting an error in MCE and it closes too. I tried to put User::Exit(0); and it gives me no errors but that way the MCE closes and i don't want it to close
If for exemple i replace my code to launch the embedded application with something like displaying an information note everything works ok with the Exit(); function.
Am i missing something, maybe some object to destroy?
Forum posts: 723
So, when the embedded application is exiting (the application you launched embedded into your app) it crashes? Is it possible that the embedded application is buggy? What is the call stack, anyway?
tOtE
Gabor Torok
Software architect, Agil Eight (http://www.agileight.com/)
Blog: http://mobile-thoughts.blogspot.com/
Forum posts: 14
So, when the embedded application is exiting (the application you launched embedded into your app) it crashes? Is it possible that the embedded application is buggy? What is the call stack, anyway?
tOtE
What crashes is the MCE that called my application because my application is associated with a mime type.
Forum posts: 723
I still don't know which application is crashing, sorry.
When an embedded application is exiting, its HandleForegroundL method is called with EFalse. After this, the embedding application's HandleForegroundL method will also be called with ETrue. I would like to know if your application's HandleForeground is called or not when it is getting back the control (from the closing embedded app).
Actually we've had a serious problem with issuing an Exit(); at the end of our app's HandleForegroundL method, but it was a really exceptional case: we delayed the Exit with an active object (so that the Exit() method was in fact called inside an AO's RunL method) and when Exit was being executed it crashed the whole application chain. I don't want to bore you with the details, because people usually don't overellaborate their applications like this and thus, you most likely have a different kind of problem.
Cheers,
tOtE
Gabor Torok
Software architect, Agil Eight (http://www.agileight.com/)
Blog: http://mobile-thoughts.blogspot.com/
Forum posts: 2
My embedded application runs for the first time perfectly and when closes, I make sure to delete the view and the document. However, when launches for the second time, it gives a panic CONE 32.
When tracing, it seems happen in the BaseConstructL called from inside the ConstructL of my app UI.
Any clue when this panic happens?
Thanks in advance.
HM.
Forum posts: 1
In this embedded application case, who is actually responsible for the capabilities of the Embedded app?
Is it the responsibility of Host application to take care of the security for embedded application or does it required to be done by the Embedded application itself?
can some one put notes on this?