×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    Registered User
    Join Date
    Mar 2009
    Posts
    8

    Trying to get Python application to foreground during phone call..

    Hi.

    I'm using the telephone module to make a call and it works perfectly except for the fact that it forces my python application to background. As far as I know there is currently no way to force python application back to foreground after the telephone.dial() from python itself, so I could use a tip for how to achieve this. I was thinking about c++ extension to try force the python application back to foreground after telephone.dial() but I have no idea how to exactly do this so any help is welcome.

  2. #2
    Nokia Developer Moderator
    Join Date
    Oct 2007
    Location
    Deva, Romania
    Posts
    3,471

    Re: Trying to get Python application to foreground during phone call..

    Hi,

    I think it will work if you use the appswitch extension to bring the app to the foreground after waiting a short while after dialing. Here's what I mean:
    Code:
    import appuifw, e32, appswitch, telephone
    
    
    a=e32.Ao_lock()
    appuifw.app.exit_key_handler=a.signal
    
    telephone.dial("xxxxxxxxx")
    e32.ao_sleep(5)  #Waits 5 seconds, but it should work with less time too
    appswitch.switch_to_fg(u"Python")
    
    a.wait()
    That code dials a number and then brings the Python script shell to the foreground.

  3. #3
    Registered User
    Join Date
    Mar 2009
    Posts
    8

    Re: Trying to get Python application to foreground during phone call..

    Thanks for the fast response but the appswitch extension doesn't work on my Nokia 5800 XpressMusic.

  4. #4
    Nokia Developer Champion
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,852

    Re: Trying to get Python application to foreground during phone call..

    Quote Originally Posted by Malefieus View Post
    Thanks for the fast response but the appswitch extension doesn't work on my Nokia 5800 XpressMusic.
    hello malefieus

    the appswitch extension is still not ported for S60 5th edition devices. so you need to wait for some time to get that working.

    Regards
    Gaba88

  5. #5
    Nokia Developer Moderator
    Join Date
    Oct 2007
    Location
    Deva, Romania
    Posts
    3,471

    Re: Trying to get Python application to foreground during phone call..

    Quote Originally Posted by Malefieus View Post
    Thanks for the fast response but the appswitch extension doesn't work on my Nokia 5800 XpressMusic.
    In what way doesn't it work? Do you get an error (if so, when and what is the error)? Does nothing happen?

    Quote Originally Posted by gaba88 View Post
    the appswitch extension is still not ported for S60 5th edition devices. so you need to wait for some time to get that working.
    I may be missing something but I'm pretty sure the old extensions built for S60 3rd work on S60 5th as long as Python 1.4.5 is used. Was there any case when they didn't? Extensions only need to be ported between PyS60 1.4.5 and the later versions, not between versions of S60 3rd and later.

  6. #6
    Nokia Developer Champion
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,852

    Re: Trying to get Python application to foreground during phone call..

    Quote Originally Posted by bogdan.galiceanu View Post
    I may be missing something but I'm pretty sure the old extensions built for S60 3rd work on S60 5th as long as Python 1.4.5 is used. Was there any case when they didn't? Extensions only need to be ported between PyS60 1.4.5 and the later versions, not between versions of S60 3rd and later.
    hello bogdan
    you are correct the extension will work absolutely fine if the developer is using PyS60 1.4.5.

    @Malefieus you need to tell us which PyS60 release you are using.

    Enjoy Pythoning
    Gaba88

  7. #7
    Registered User
    Join Date
    Mar 2009
    Posts
    8

    Re: Trying to get Python application to foreground during phone call..

    Quote Originally Posted by gaba88 View Post
    @Malefieus you need to tell us which PyS60 release you are using.
    I'm using 1.9.4 because I need touch support. I could always do my own extension but for that I need some help. I have never done any extension and I don't know how the api for switching applications to foreground/background works.

  8. #8
    Nokia Developer Moderator
    Join Date
    Oct 2007
    Location
    Deva, Romania
    Posts
    3,471

    Re: Trying to get Python application to foreground during phone call..

    I think you can find some info about that in the Wiki (at least searching for the word "background" returned some promising results). But before you start writing your own extension you might want to see if you can port the existing one to the new version of PyS60. Instructions on how to do that can be found in pys60-1.9.5_src.zip, in src\PyS60_1_9_x_README.txt (point 6.2)

    There are some tutorials available, such as this one or this one.

  9. #9
    Registered User
    Join Date
    Mar 2009
    Posts
    8

    Re: Trying to get Python application to foreground during phone call..

    Quote Originally Posted by bogdan.galiceanu View Post
    But before you start writing your own extension you might want to see if you can port the existing one to the new version of PyS60
    Thank you for help. This got it to work with Pys60 1.9.4.

  10. #10
    Nokia Developer Champion
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,852

    Re: Trying to get Python application to foreground during phone call..

    Quote Originally Posted by Malefieus View Post
    Thank you for help. This got it to work with Pys60 1.9.4.
    hello malefieus

    did you got the extension working on PyS60 1.9.x.

    Can you share that with the forum.

    Regards
    Gaba88

  11. #11
    Registered User
    Join Date
    Mar 2009
    Posts
    8

    Re: Trying to get Python application to foreground during phone call..

    Yeah I got it working and I can share it sure. It's just going to take couple of days as the distance between the code and me is about 160km at the moment It only took some little changes to the original code and the mmp file to get it working.

  12. #12
    Registered User
    Join Date
    Jun 2009
    Posts
    4

    Re: Trying to get Python application to foreground during phone call..

    Right now, I have the same problem, but with incoming calls. Appswitch doesn't seem to be able to bring Python to foreground when the phone is ringing. Is there any workaround for this problem?

    Edit: The program is here, if you want to try: http://pastebin.ca/1466944 . It takes the caller id of incoming calls and submits it to a german phone book (pda.telefonbuch.de) service to reverse lookup caller information (right now only the name of the caller). Obviously, it needs appswitch, plus you need the py files from http://pymbian.sourceforge.net/misc/...0.20060611.zip in e:\python\lib to store access point information.
    Last edited by unbehagen; 2009-06-20 at 01:09.

  13. #13
    Registered User
    Join Date
    Mar 2009
    Posts
    8

    Re: Trying to get Python application to foreground during phone call..

    Sorry, forgot to give the appswitch code here yesterday. Of course the original appswitch code is not from me but I can't remember where I exactly found it. So if someone recognizes this code, feel free to claim copyrights for it. Tested it on 5800XM with PyS60 1.9.4.

    http://users.jyu.fi/~oujovalk/appswitch/appswitch.zip

  14. #14
    Nokia Developer Champion
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,852

    Re: Trying to get Python application to foreground during phone call..

    Quote Originally Posted by Malefieus View Post
    Sorry, forgot to give the appswitch code here yesterday. Of course the original appswitch code is not from me but I can't remember where I exactly found it. So if someone recognizes this code, feel free to claim copyrights for it. Tested it on 5800XM with PyS60 1.9.4.

    http://users.jyu.fi/~oujovalk/appswitch/appswitch.zip
    hello Malefius

    thanks for the appswitch link.

    Regards
    Gaba88

  15. #15
    Registered User
    Join Date
    Mar 2009
    Posts
    8

    Re: Trying to get Python application to foreground during phone call..

    Hello again

    I keep running on the same problem as unbehagen, appswitch can't bring python back to foreground when someone calls me. Also, appswitch "lags" a little too much for my use as I need to have my python application on top all the time so I created a new extension, aotext (AlwaysOnTopExtension). This fixes some other problems too like disables every hardware button from N5800 (except that damn mediabutton ) and it doesn't lag like appswitch does as it doesn't switch foreground applications, it just forces the priority up. The problem is, it still can't keep python on foreground when someone calls, so can someone tell me how to exactly improve this code? The code is mainly these four lines:

    Code:
    CEikonEnv::Static()->SetSystem(ETrue);
    CEikonEnv::Static()->WsSession().ComputeMode(RWsSession::EPriorityControlDisabled);
    
    CEikonEnv::Static()->RootWin().EnableReceiptOfFocus(ETrue);
    CEikonEnv::Static()->RootWin().SetOrdinalPosition(0, ECoeWinPriorityAlwaysAtFront);
    Old solution for getting priority up can be found on the source code commented out above those four lines if someone is interested.

Similar Threads

  1. Call for webkit GUI and application engine model
    By yant in forum Symbian User Interface
    Replies: 1
    Last Post: 2009-04-16, 10:04
  2. Sending audio over phone call
    By workmaster2 in forum Symbian
    Replies: 0
    Last Post: 2008-02-13, 19:55
  3. Problem in makeing Phone Call in 2nd edition
    By yogesh.bhople in forum Symbian
    Replies: 4
    Last Post: 2006-11-18, 08:47
  4. How to make simultaneous VOICE and DATA call on a Nokia Phone?
    By venkat_nokia in forum PC Suite API and PC Connectivity SDK
    Replies: 0
    Last Post: 2004-04-28, 12:15

Posting Permissions

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