×

Discussion Board

Results 1 to 15 of 15
  1. #1
    Regular Contributor
    Join Date
    Jun 2008
    Location
    Jordan
    Posts
    213

    Bring the application to the foreground with a key pressed!

    Hello Everybody,

    is that possible to launch my application\ bring my application to the foreground with a key pressed (lets say * key) through mobile idle screen?
    Regards,
    Leonard

  2. #2
    Nokia Developer Moderator
    Join Date
    Oct 2006
    Location
    Finland
    Posts
    4,490

    Re: Bring the application to the foreground with a key pressed!


  3. #3
    Regular Contributor
    Join Date
    Jun 2008
    Location
    Jordan
    Posts
    213

    Re: Bring the application to the foreground with a key pressed!

    Thank you ,

    Yes, i trying this one ,, but it did not worked.

    Do you understood what i mean, i want my application to launch when i pressed * key through the idle screen..
    Regards,
    Leonard

  4. #4
    Regular Contributor
    Join Date
    Jun 2008
    Location
    Jordan
    Posts
    213

    Re: Bring the application to the foreground with a key pressed!

    Code:
    void CMyApplicationAppUi::HandleWsEventL( const TWsEvent& aEvent, CCoeControl* aDestination )
    {
    if (aEvent.Type() == KAknUidValueEndKeyCloseEvent)
    {
    TApaTask myApp(iEikonEnv->WsSession()) ;
    myApp.SetWgId(CEikonEnv::Static()->RootWin().Identifier()) ;
    myApp.SendToBackground() ;
    }
    
    if(aEvent.Type() == EStdKeyNkpAsterisk)
    {
    TApaTask mytask(iEikonEnv->WsSession());         mytask.SetWgId(CEikonEnv::Static()->RootWin().Identifier());
    mytask.BringToForeground();
    }
    
        CEikAppUi::HandleWsEventL(aEvent,aDestination) ;
    }

    Note: When i use the first one ,, which is sending the application to the background when pressing The red key(terminate call key) , my application was sent to the background successfully ,, but pressing the Asterisk key through the idle screen,, the application will never bring to the foreground.


    Is there any solution for issue?

    Thanks in advance.
    Regards,
    Leonard

  5. #5
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,567

    Re: Bring the application to the foreground with a key pressed!

    That aEvent.Type() will never be "EStdKeyNkpAsterisk". Try to understand the example (for example you can simply test it without any modifications) and read the documentation.

  6. #6
    Nokia Developer Moderator
    Join Date
    Oct 2006
    Location
    Finland
    Posts
    4,490

    Re: Bring the application to the foreground with a key pressed!

    Quote Originally Posted by amerzannouneh View Post
    Code:
    void CMyApplicationAppUi::HandleWsEventL( const TWsEvent& aEvent, CCoeControl* aDestination )
    {
    if (aEvent.Type() == KAknUidValueEndKeyCloseEvent)
    {
    TApaTask myApp(iEikonEnv->WsSession()) ;
    myApp.SetWgId(CEikonEnv::Static()->RootWin().Identifier()) ;
    myApp.SendToBackground() ;
    }
    
    if(aEvent.Type() == EStdKeyNkpAsterisk)
    {
    TApaTask mytask(iEikonEnv->WsSession());         mytask.SetWgId(CEikonEnv::Static()->RootWin().Identifier());
    mytask.BringToForeground();
    }
    
        CEikAppUi::HandleWsEventL(aEvent,aDestination) ;
    }

    Note: When i use the first one ,, which is sending the application to the background when pressing The red key(terminate call key) , my application was sent to the background successfully ,, but pressing the Asterisk key through the idle screen,, the application will never bring to the foreground.


    Is there any solution for issue?

    Thanks in advance.
    Because EStdKeyNkpAsterisk is the scancode for the physical key. while the KAknUidValueEndKeyCloseEvent is an UID of an event

  7. #7
    Regular Contributor
    Join Date
    May 2006
    Location
    Milan, Italy
    Posts
    92

    Re: Bring the application to the foreground with a key pressed!

    You can bring your application to foreground with this code sample ( capture key + bring application ).
    You can't launch it because if the application is not previously started could not be able to capture any keys...

    If you want to start an application with a key you need a second application that capture the keys and then start the first one. ( I worked to something similar and I used this approach... )

    Ste

  8. #8
    Regular Contributor
    Join Date
    Jun 2008
    Location
    Jordan
    Posts
    213

    Re: Bring the application to the foreground with a key pressed!

    Thank you all,

    all i want to do is, after running my application then send it to the background ,, it is possible that i can press hash key from the idle screen (override the behavior of the hash key), so that it will bring my application to the foreground.
    Regards,
    Leonard

  9. #9
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,567

    Re: Bring the application to the foreground with a key pressed!

    Hmm, revising your code snipet a slight notice: though you send your application to the background on the red-key event, your application also forwards this event to CEikAppUi, which then exits your application.
    Put a "return;" after SendToBackground.

    This is why you should use [CODE ] and [/CODE ] tags in the future: they preserve indentation thus enhance readability.

  10. #10
    Regular Contributor
    Join Date
    Jun 2008
    Location
    Jordan
    Posts
    213

    Re: Bring the application to the foreground with a key pressed!

    Thank you wizard for your quick reply,

    on most Nokia mobile phones ,, when user press the hash key, user profile will switch to the silent mode,,

    I want to override this behavior ,, so that it will run my application instead of switching to the silent mode....

    Is that possible wizard,,
    Thank you
    Regards,
    Leonard

  11. #11
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,567

    Re: Bring the application to the foreground with a key pressed!

    The documentation says
    Quote Originally Posted by SDK Help
    more than one window group may have requested key capture. If multiple window groups have requested to capture the same key using this function, the key is sent to the window group that most recently requested the key capture.
    My guess would be that your request is going to be the most recent one. Just check the return value if it contains an error code.

  12. #12
    Regular Contributor
    Join Date
    Jun 2008
    Location
    Jordan
    Posts
    213

    Re: Bring the application to the foreground with a key pressed!

    Please wizard understand what i want to do,

    Quote Originally Posted by amerzannouneh View Post
    on most Nokia mobile phones ,, when user press the hash key, user profile will switch to the silent mode,,

    I want to override this behavior ,, so that it will run my application instead of switching to the silent mode....

    Is that possible wizard,,
    Thank you
    Please help, Urgent issue.
    Thanks in advance,
    Regards,
    Leonard

  13. #13
    Regular Contributor
    Join Date
    Jun 2008
    Location
    Jordan
    Posts
    213

    Question Re: Bring the application to the foreground with a key pressed!

    Hello all,

    Anybody can help me for my problem,
    Your help will be greatly appreciated,
    Regards,
    Leonard

  14. #14
    Registered User
    Join Date
    Nov 2007
    Posts
    444

    Re: Bring the application to the foreground with a key pressed!

    You can make an exe for key capturing and run this exe as server in background.

    Then in that exe you can code for checking the "*" key if it is then open the application.

    So thus you need to study...
    1) console application
    2) Run console/exe at start up
    3) key capturing
    4) open the application from exe

    All these aspects are properly described in wiki.
    You need to make relevant search for them.
    Regards,
    Kavit.

  15. #15
    Regular Contributor
    Join Date
    Jun 2008
    Location
    Jordan
    Posts
    213

    Thumbs up Re: Bring the application to the foreground with a key pressed!

    Thank you Kavit,

    I like reading and searching ,, so i will check this and let you know Kavit
    Regards,
    Leonard

Similar Threads

  1. Replies: 8
    Last Post: 2009-01-24, 06:00
  2. Key I need for application ends the application
    By RedOctober in forum General Development Questions
    Replies: 1
    Last Post: 2008-06-24, 23:33
  3. How to send a key event to foreground application?
    By wanglele76 in forum Symbian Media (Closed)
    Replies: 7
    Last Post: 2007-09-20, 14:11
  4. Bring Application Foreground
    By saiful_nokia in forum Symbian C++
    Replies: 6
    Last Post: 2007-03-14, 16:52
  5. Bringing Background application to foreground
    By Varadarajanm in forum Symbian C++
    Replies: 1
    Last Post: 2007-02-21, 02:43

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •