Hello friends,
How to stop or start one application from another if it is already running or not?
Bheda Dilipsinh
Hello friends,
How to stop or start one application from another if it is already running or not?
Bheda Dilipsinh
first you need to check whether the app is running or not
http://wiki.forum.nokia.com/index.ph...w_to_find_them
after that you can see here http://wiki.forum.nokia.com/index.ph...t_and_stop_exeCode:TBool IsProcessRunning(void) { TBool Ret(EFalse); TFileName res; TFindProcess find; while(find.Next(res) == KErrNone) { RProcess ph; ph.Open(res); if(ph.SecureId() == 0x2003CAC6)// SID of the process we are looking for { Ret = ETrue; ph.Close(); break; } ph.Close(); } return Ret; }
Last edited by somnathbanik; 2011-04-12 at 13:11. Reason: added
to launch app from another app try this
Code:const TUid KAppUid={0x2003CAC6}; _LIT(KDocName,"C:\\Data\\document.txt"); TThreadId app_threadid; RApaLsSession ls; User::LeaveIfError(ls.Connect()); TInt err=ls.StartDocument(KDocName, KAppUid, app_threadid); ls.Close();
The application matters a lot. In case of a GUI app, TApaTask::EndTask results in a standard EEikCmdExit command, and the application can exit normally. It will require PowerMgmt capability.
Arbitrary processes can be shut down via RProcess::Terminater, Kill, etc. methods. This results in abrupt termination though, applications will not get the chance to save their data. These methods also require PowerMgmt capability.
If you want to shut down your own code, you can simply have some dedicated IPC feature for handling shutdown requests. Watching for an RProperty can do the job. This variant results in normal exit and does not require any capabilities.
To stop process you may need to kill according to this thread http://wiki.forum.nokia.com/index.ph...t_and_stop_exe
Go to the Killing section of the thread, I tried but got some error, as it requirs some capability as wizard_hu_ mentioned.
I tried to kill my console application from GUI as in thread provided by 'banik', but things are not working. My GUI application crash-down when try to kill Console in my device. But on emulater debug, its working.
Bheda Dilipsinh
Wizard, How can i check whether i have the PowerMgmt capability or not?
or how to get it?
Bheda Dilipsinh
Learn about platform security if you have not done that so far. CAPABILITY is a keyword in the .mmp file, and Carbide.c++ also provides an editor for setting them. But PowerMgmt can not be self-signed, so you will need the free Open Signed Online service as a minimum (http://www.symbiansigned.com)
Emulator does not enforce capabilities, just provides warnings about them in its logfile (http://wiki.forum.nokia.com/index.php/Epocwind.out)
There is no crash, there are specific panics (http://wiki.forum.nokia.com/index.ph...ded_panic_code)
Means i just have to add one word called "PowerMgmt " infront of "CAPABILITY" in .mmp file. And then need to sign it with OpenSignedOnline.
Bheda Dilipsinh
Yes, that is the simplest and cheapest approach.
"CAPABILITY PowerMgmt"
After signing with OpenSignedOnline :
Its working properly.
Thanks & Regards
Bheda Dilipsinh
I have implemented the code provided here on Symbian S60 3rd edition and its working.
But do this same code will work with S60 2nd edition?
Because i didnt found the CAPABILITY in the all 2nd edition application's mmp file.
If "No" then what to do for S60 2nd edition?
-Bheda Dilipsinh
On S60 2nd/1st edition there are no capabilities, anyone can do anything. You can try and it is expected to work.