×

Discussion Board

Results 1 to 15 of 15

Thread: pauseApp()

  1. #1
    Regular Contributor
    Join Date
    Apr 2007
    Posts
    233

    pauseApp()

    Hi all,

    I have read that pauseApp is not called correctly when an incoming call, sms or mms are received in a series 60 device. I have tested it, and it seems that it is correct. Then I would like to know how to detect these events in a MIDlet composed of some Displayables and a Canvas, to pause my application (mp3 player), and be able to restart it after the call is received. I have read about hideNotify in Canvas, but what about high level API?

  2. #2
    Super Contributor
    Join Date
    Apr 2003
    Location
    USA, CA
    Posts
    7,191

    Re: pauseApp()

    "I have read that pauseApp is not called correctly when an incoming call"

    Well, it is not called. This is as correct behavior as any.
    Snippet from the MIDP 2.0 spec
    "The application management software wants the MIDlet to significantly reduce
    the amount of resources it is consuming, so that they may temporarily be used
    by other functions on the device such as a phone call or running another
    MIDlet. The AMS will signal this request to the MIDlet by calling the
    MIDlet.pauseApp method. The MIDlet should then reduce its resource
    consumption as much as possible."

    This is the closest reference to phone call and pauseApp I can find from the MIDP spec, and even in here it is not stated that pausApp has to be called when a call comes in. I could be called if resources needs to be released, but it does not have to be called.

    Done with ranting....


    use hideNotify in Canvas
    For high-level UI elements you can check with isShown if a high-level UI element (like Form) is visible

    Hartti

  3. #3
    Regular Contributor
    Join Date
    Apr 2007
    Posts
    233

    Re: pauseApp()

    Yes, I can use hideNotify, but how can I to know if there is really an incoming call? That is the problem, because the canvas can be hiden by some reasons (for instance by a VM security dialog)... On the other hand what would you do with isShown? Would you have a thread to check every second if the current Displayable is shown?

  4. #4
    Super Contributor
    Join Date
    Apr 2003
    Location
    USA, CA
    Posts
    7,191

    Re: pauseApp()

    There is no indication on the hideNotify call what has caused the call. AFAIK pauseApp also lacks this type of granular notification (it could be called also for other reasons than getting a call)

    You should probably check the isShown evey now and then. Usually not getting immediately information about not being on the foreground is not so critical for high-level UI apps, which are usually waiting for user input anyway.

    (how many "not" words I was able to cram in the sentence above.. amazing...)

    Hartti

  5. #5
    Regular Contributor
    Join Date
    Apr 2007
    Posts
    233

    Re: pauseApp()

    My application is a mp3 player, with more functionality. The main tasks that need to be performed when a call is received is to pause the player, and when the call is finished to restart that.

    So I could check the two cases, one of them through notification and the other with a thread... I will try it and comment the results.

    Thank you.

  6. #6
    Regular Contributor
    Join Date
    Apr 2007
    Posts
    233

    Re: pauseApp()

    And how can I to know if the call is finished? For instance it would be necessary to restart the mp3 player... In the case of the UI high level API with isShown function, but in the case of Canvas... I would need a function similar to hideNotify but that is called when the Canvas is shown.

    Thank you.

  7. #7
    Regular Contributor
    Join Date
    Apr 2007
    Posts
    233

    Re: pauseApp()

    Finally I have implemented a timer which checks if the current Displayable is shown every second. It works correctly, excepting when I open the Options menu, because the music should be playing then. When the menu Options is opened the current view seems that it was not shown... How could I deal with that problem?

  8. #8
    Regular Contributor
    Join Date
    Apr 2007
    Posts
    233

    Re: pauseApp()

    Please any help!

  9. #9
    Super Contributor
    Join Date
    Apr 2003
    Location
    USA, CA
    Posts
    7,191

    Re: pauseApp()

    Not an answer you want to hear, but sounds like you might want to use Canvas (no need to poll and showing the menu would not cause problem - the drawback is of course that you need to implement the UI all by yourself

    Hartti

  10. #10
    Regular Contributor
    Join Date
    Apr 2007
    Posts
    233

    Re: pauseApp()

    I think it is not possible. It is a lot of work. We are thinking about using J2MEPolish, but the main problem that we are finding is the jar size, because a test that we did a simple application had almost 1Mb... Now we have the application composed of a canvas, and some List...

  11. #11
    Regular Contributor
    Join Date
    Apr 2007
    Posts
    233

    Re: pauseApp()

    I have achieved the goal. It was as easy as override hideNotify and showNotify in Canvas, and in the high level UI API views to use a timer which checks isShown method of the current displayable.

    It works fine!

    Thank you of any way.

  12. #12
    Super Contributor
    Join Date
    Apr 2003
    Location
    USA, CA
    Posts
    7,191

    Re: pauseApp()

    Good to hear you were able to solve your issues!

    Hartti

  13. #13
    Registered User
    Join Date
    Sep 2007
    Posts
    4

    Re: pauseApp()

    Hello!

    Can you please post the code how to detect the current displayable object and the timer for polling isshown?

    thanks a lot

  14. #14
    Super Contributor
    Join Date
    Jun 2007
    Location
    Mumbai
    Posts
    539

    Re: pauseApp()

    hi chris just use display.getCurrent() and u will get current displayable. and for ur polish stuff i would like to say i am using that in my project and if u use proper obfuscation and ant build tool ur code size wont be that much.

  15. #15
    Registered User
    Join Date
    Sep 2007
    Posts
    4

    Re: pauseApp()

    Quote Originally Posted by prakash.raman View Post
    hi chris just use display.getCurrent() and u will get current displayable. and for ur polish stuff i would like to say i am using that in my project and if u use proper obfuscation and ant build tool ur code size wont be that much.

    Thanks for your answer!! Following works. i have a background thread, checking if a display is active every milliseconds. If no display is active, than it is assumed that the midlet is passive and a flag is set. But the problem now is, how can I check, if the user returns to the midlet? normally, the startapp() method is called again, but not at nokia devices. I want to show an alert screen "Lets go on..." when the user comes back.

    If I display this screen immediately when the flag pause is set true, than the passive midlet is pushed to the foreground and displayed to the user, what I don't want. The user should decide, when to retourn to the midlet...

Similar Threads

  1. pauseApp never called?
    By scole96 in forum Mobile Java General
    Replies: 12
    Last Post: 2006-08-24, 15:09
  2. PauseApp
    By johnbutler in forum Mobile Java General
    Replies: 0
    Last Post: 2005-11-29, 19:53
  3. Help with pauseApp()
    By SanDan in forum Mobile Java General
    Replies: 2
    Last Post: 2003-07-01, 14:57
  4. 6310i and pauseApp()
    By KarlC in forum Mobile Java General
    Replies: 4
    Last Post: 2003-04-24, 15:44
  5. pauseApp on Nokia 3410
    By rafffi in forum Mobile Java General
    Replies: 1
    Last Post: 1970-01-01, 02:00

Posting Permissions

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