Wednesday, January 13, 2016
S60 next, how to get a program running in the background
Want a program that functions as follows:
Each boot automatically run a program that has been running in the background to monitor the SMS inbox to do something based on message content.
Now the program since the launch of the program has been studied almost, monitor messages also read some, and now do not know how to get alone monitoring program has been running in the background, please help!
Brother first thanked!
Reply:
Your program will always run in the background until:
1. It is the initiative to withdraw, or
2. The others kill it
Reply:
Boot from the start to use the Internet to find a mdl program, use it to start the exe
a followingvoid DoMainL ()
{
// Prepare to call and monitor related code
message here}
GLDEF_C TInt E32Main () // main function called by E32
{
__UHEAP_MARK;
CTrapCleanup * cleanup = CTrapCleanup :: New (); // get clean-up stack
TRAPD (error, DoMainL ()); // more initialization, then do example
delete cleanup; // destroy clean-up stack
__ASSERT_ALWAYS (Error, User :: Panic (KTxtElements, error)!);
__UHEAP_MARKEND;
return 0; // and return
}
Reply:
My listener as follows:
class mysmsobserver: public MMsvSessionObserver
{
public:
void HandleSessionEventL (TMsvSessionEvent aEvent,
TAny * aArg1, TAny * aArg2, TAny * / * aArg3 * /);
mysmsobserver :: mysmsobserver ();
virtual mysmsobserver :: ~ mysmsobserver ();
};
void mysmsobserver :: HandleSessionEventL (TMsvSessionEvent aEvent,
TAny * aArg1, TAny * aArg2, TAny * / * aArg3 * /)
{
TMsvId * folderId;
CMsvEntrySelection * aselection;
aselection = static_cast & lt; CMsvEntrySelection * & gt; (aArg1);
folderId = static_cast & lt; TMsvId * & gt; (aArg2);
switch (aEvent) {
case EMsvEntriesCreated:
// My operating
break;
case EMsvEntriesChanged:
// My operating
break;
......................
}
}
Reply:
Now we are on the research of these.
I want to run a program that listens SMS is to run in the background, what kind of feeling should not have a graphical interface, it should not be an app, I just look symbian this, only one and a half, you know limited, please sub Teng brother a lot of help!
Reply:
TApaTask * task;
task = new TApaTask (iEikonEnv- & gt; WsSession ());
task- & gt; SetWgId (CEikonEnv :: Static () - & gt;. RootWin () Identifier ());
task- & gt; SendToBackground ();
The program brought back. That you can always run the program
Reply:
http://blog.csdn.net/windcao/archive/2006/04/21/671846.aspx
I hope this article help you
I want to be a listener address book program
Not yet begun
More exchanges
qq: 276877017 indicate symbian
Reply:
Indeed, your listeners should be .exe type.
Because you monitor SMS is an asynchronous operation, so you should () function in the creation and installation activities in DoMainL scheduler, and then create your observer object and issue an asynchronous request, the last start-up activities scheduler.
The following code is merely an example:
void DoMainL ()
{
// Create and install an active scheduler
CActiveScheduler * scheduler = new (ELeave) CActiveScheduler;
CleanupStack :: PushL (scheduler); // push to clean-up stack
// Install active scheduler
CActiveScheduler :: Install (scheduler);
CMySmsObserver * observer = CMySmsObserver :: NewL (); // create observer objects
// Start active scheduler, then the program will "freeze" Here, when a notice soon the system will call HandleSessionEventL () function
CActiveScheduler :: Start ();
CleanupStack :: PopAndDestroy (); // scheduler
}
CMySmsObserver * CMySmsObserver :: NewL ()
{
CMySmsObserver * self = new (ELeave) CMySmsObserver ();
CleanupStack :: PushL (self);
self- & gt; ConstructL ();
CleanupStack :: Pop ();
return self;
}
void CMySmsObserver :: ConstructL ()
{
// Issue an asynchronous request
iMsvSession = CMsvSession :: OpenAsyncL (* this);
...
}
void CMySmsObserver :: HandleSessionEventL (...)
{
// If you want the program to continue running, you should after handling the event again issue an asynchronous request
// If you want the program to quit, you should call CActiveScheduler :: Stop (), this program will () at the exit from the above CActiveScheduler :: Start.
}
Reply:
Thank wenstory and sub-Tang brother's help
Reply:
mark
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment