How to bring to foreground when incoming call?

Login to reply to this topic.
Fri, 2003-12-05 23:12
Joined: 2003-12-05
Forum posts: 1
I have active object listen incoming call ,it work fine. When incoming call my application can't bring to foreground. i use this code..

TApaTask task(iEikonEnv->WsSession());
task.SetWgId(CEikonEnv::Static()->RootWin().Identifier());
task.BringToForeground();


my purpose, i want to repaint on screen override notedialog(show caller name).

Thanks.

Atchariya

Sat, 2005-11-05 18:50
Joined: 2004-11-25
Forum posts: 5
Re: How to bring to foreground when incoming call?
Hi ,
Can you please help me to bring my app to forground on incomming call.

Regards

rami75lu

Tue, 2006-03-14 23:09
Joined: 2005-05-19
Forum posts: 45
Re: How to bring to foreground when incoming call?
To bring your app to the forground once an incomming call is identified, create a method in your CAknViewAppUi derived class with the following code:

void CP2pmAppUi::BringToForeground()
{
     TApaTask task(iEikonEnv->WsSession());
     task.SetWgId(CEikonEnv::Static()->RootWin().Identifier());
     task.BringToForeground();
}

as was done with the code posted by atchariya... but the trick is not fighting with the phone.app (the priority client) for the foreground position.  To make this work, I setup my code so that it did not try to answer the call on the first ring... by adding a time delay like the following:

User::After(KP2pmWaitTime);

where KP2pmWaitTime is equal to 1000000 ... between the time I open the call to the time I answer the call... seemed to fix the problem.  You can probably put this time delay anywhere before the call to BringToForeground() or at the top of the method... so that the phone app has time to register the call...and then switch to you app.

It works for me... but I was okay with letting the phone ring once or twice before pickup.  Hope this helps.  BTW, this has only been tested on the N6600.  Smiley

"If we knew what it was we were doing, it would not be called research, would it?" - Albert Einstein

  • Login to reply to this topic.