Nov 23

On Series 60 3rd edition, pressing the END key will kill your application instead of bringing it to the background. In some applications, this behaviour is unwanted (e.g: Instant Messaging application), and the old behaviour is preferred.

To handle the END key, you can create a method HandleWsEvent, and intercept the KAknUidValueEndKeyCloseEvent, you can save the state of the of the app then exit, or saving the application state then go to background, or just go to background.

#ifdef __SERIES60_30__
void CS60BibleAppUi::HandleWsEventL (const TWsEvent &aEvent, CCoeControl *aDestination)
{
  
switch (aEvent.Type()) {
        case KAknUidValueEndKeyCloseEvent:
        {
            /*do something, like saving the state.
If you want your program to exit, call  CAknAppUi::HandleWsEventL(aEvent, aDestination);*/
            break; /*or just go to background*/
        }
        default:
        {
            CAknAppUi::HandleWsEventL(aEvent, aDestination);
        }
    }
}
#endif

Topics: General |

7 Responses to “Porting to Series 60 3rd Edition: Handle the End Key”

    dd Says:
    January 29th, 2007 at 5:33 pm

    You shouldn’t break the S60 coding conventions. For every app, the red key should close it.

    yohanes Says:
    July 13th, 2007 at 9:27 am

    Yes, but when you are in the middle of a chat, and accidentally press the red key, then you will need to reconnect. This handling of end key are not meant for all applications.

    Some applications have a very long startup time, and relaunching those kind of applications is really annoying. I wish that Nokia could give an option for each application whether it should be closed when you press the red button or not.

    cyke64 Says:
    July 15th, 2007 at 12:53 am

    Sorry dd but i don’t agree with you :-(
    This change for 3rd was a error because they break themselves THEIR convention !
    It’s too easy to quit an important application (it kill the app really :( without advertising the user !!!! The only good way for exiting an application it’s the exit item in the option menu !
    Imagine that M$ has put a key near the spacebar for killing the app … There was a nightmare for the user :D !

    Cyke64

    rd Says:
    September 24th, 2008 at 3:49 pm

    if i want …when i press the red button the the program will just do a particular task which i have fixed (such as: displaying a pop up or hang up a established call) and remain it in the foreground , neither go to the background nor exit…..then what i have to do?

    Yohanes Says:
    September 24th, 2008 at 3:53 pm

    @rd: do what you want to do inside the “case KAknUidValueEndKeyCloseEvent:” and just return from there.

    rd Says:
    September 24th, 2008 at 5:36 pm

    I just want to know that is there is a way to press Red(End) Button but the application will not go to background or will no exit… it will do any other task like display something

    Thanks

    Yohanes Says:
    September 24th, 2008 at 5:41 pm

    Hi,

    sorry, I didn’t realize that the default behavior is always to push the application to background.

    from the answer by wizard_hu here:

    http://discussion.forum.nokia.com/forum/showthread.php?t=108313&page=2

    “The Red key always pushes your application into the background. The most you can do is bringing it back to the foreground “soon”. Soon might be a short timer, or some other event.”

Comments