×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 21
  1. #1
    Regular Contributor
    Join Date
    Mar 2010
    Posts
    136

    When the MIDlet is in the paused state?

    When the MIDlet is in the paused state? In the book, it is said that “ While the MIDlet is Active, the application manager can suspend its execution by calling pauseApp(). This puts the MIDlet back in the Paused state. A MIDlet can place itself in the Paused state by calling notifyPaused().”
    When should we call notifyPaused()? How can we go back to the active state?
    Last edited by komomo; 2010-06-14 at 04:48.

  2. #2
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Re: When the MIDlet is in the paused state?

    Quote Originally Posted by komomo View Post
    1.When the MIDlet is in the paused state?

    2.In the book, it is said that “ While the MIDlet is Active, the application manager can suspend its execution by calling pauseApp(). This puts the MIDlet back in the Paused state. A MIDlet can place itself in the Paused state by calling notifyPaused().”

    3.When should we call notifyPaused()? How can we go back to the active state?
    1.MIDlet is put into a paused state by the AMS creating an instance of it, by calling its no-args constructor. This is of course, not the only way that the MIDlet can be in a paused state. It can enter this state when the AMS calls the pauseApp() method on an active MIDlet (and the method returns successfully). It can also enter this state when the MIDlet pauses itself by calling the notifyPaused() method, as opposed to the pauseApp() method, which is called by the AMS. However, what exactly is happening with the MIDlet in the paused state?

    f the MIDlet should inform the AMS that it has paused, it should invoke the notifyPaused() method, which tells the AMS that the MIDlet has indeed paused.

    One final way in which a MIDlet can get into a paused state is when the MIDlet's startApp() method, which is called when the AMS invokes it to start the MIDlet (either the first time or from a paused state), throws a MIDletStateChangeException. Essentially, in case of an error, the MIDlet takes the safe road of staying in the paused state.

    2.Correct indeed, do you have any confusions about this?

    3.If the MIDlet should inform the AMS that it has paused, it should invoke the notifyPaused() method, which tells the AMS that the MIDlet has indeed paused.

    For any other concern please write back..
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  3. #3
    Regular Contributor
    Join Date
    Mar 2010
    Posts
    136

    Re: When the MIDlet is in the paused state?

    Thank you very much for your kind reply.
    The fact I am confused is that when and why we shoud call notifyPaused(). For example, In a game program, we are busy for about 2 min and we want to pause that game for 2 mins. For that case, we will use Pase command. In the program, we will write the program like that if we choose the Pause command, we will call notifyPaused() and the program will go to paused state ( the program will also go to the pauseApp() ?)
    When we want to play agian, we will choose the play menu and it will go to startAPP()?

    I am sorry if my question is a very stupid one.

  4. #4
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Re: When the MIDlet is in the paused state?

    I guess you should understand that the notifyPaused( ) method informs the platform that the MIDlet wishes to be moved to the Paused state; this has the same effect as if the platform had invoked the MIDlet's pauseApp( ) method. When the MIDlet calls notifyPaused( ), the platform does not invoke its pauseApp( ) method, in the same way that it does not call destroyApp( ) in response to notifyDestroyed( ), because it assumes that the MIDlet has prepared itself to be paused. A MIDlet often, therefore, precedes an invocation of notifyPaused( ) with a call to pauseApp( ) so that the appropriate steps are taken before the MIDlet is suspended.

    The resumeRequest( ) method is the reverse of notifyPaused( ); it tells the platform that a MIDlet in the Paused state wishes to return to the Active state. At some future time, the platform may resume the MIDlet by calling its startApp( ) method. The resumeRequest( ) method typically is called by a background thread or from a timer that the MIDlet left active while it was paused,
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  5. #5
    Regular Contributor
    Join Date
    Mar 2010
    Posts
    136

    Re: When the MIDlet is in the paused state?

    Thank you very much raj!
    So if we choose the Pause command, we will call notifyPaused() and the program will go to paused state.
    To start the program, we have to call resumeRequest() .

  6. #6
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Re: When the MIDlet is in the paused state?

    Quote Originally Posted by komomo View Post
    Thank you very much raj!
    So if we choose the Pause command, we will call notifyPaused() and the program will go to paused state.
    To start the program, we have to call resumeRequest() .
    Exactly ..
    Did you read the WTK docs..?
    Here they said.
    public final void resumeRequest()

    Provides a MIDlet with a mechanism to indicate that it is interested in entering the Active state. Calls to this method can be used by the application management software to determine which applications to move to the Active state.

    When the application management software decides to activate this application it will call the startApp method.

    The application is generally in the Paused state when this is called. Even in the paused state the application may handle asynchronous events such as timers or callbacks
    I hope these lines help you in any means..
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  7. #7
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: When the MIDlet is in the paused state?

    Quote Originally Posted by komomo View Post
    So if we choose the Pause command, we will call notifyPaused() and the program will go to paused state..
    I strongly suggest you never ever call notifyPaused(). There is really no useful reason for doing this.

    What problem are you trying to solve?

    Graham.

  8. #8
    Registered User
    Join Date
    Dec 2007
    Posts
    2

    Re: When the MIDlet is in the paused state?

    I hope these lines help you in any means..

  9. #9
    Regular Contributor
    Join Date
    Mar 2010
    Posts
    136

    Re: When the MIDlet is in the paused state?

    As I have asked, what should I do if I want to pause the game I was playing if I should not call notifyPaused()?
    Quote Originally Posted by grahamhughes View Post
    I strongly suggest you never ever call notifyPaused(). There is really no useful reason for doing this.

    What problem are you trying to solve?

    Graham.

  10. #10
    Registered User
    Join Date
    Oct 2009
    Location
    Noida
    Posts
    941

    Re: When the MIDlet is in the paused state?

    Quote Originally Posted by komomo View Post
    As I have asked, what should I do if I want to pause the game I was playing if I should not call notifyPaused()?
    To pause your game, you dont need to send the Midlet on pused state but you just need to pause the processing thread of your Game and resume later on user request.
    Thanks,
    Ekta

  11. #11
    Regular Contributor
    Join Date
    Mar 2010
    Posts
    136

    Re: When the MIDlet is in the paused state?

    If so , although there is pauseApp() method, it is a method we ( application programmers) never use?

  12. #12
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Re: When the MIDlet is in the paused state?

    Quote Originally Posted by komomo View Post
    If so , although there is pauseApp() method, it is a method we ( application programmers) never use?
    You need to handle the events who can lead (and we have to manager that) the game in such a situation that we must pause the game, for example
    1. Incaoming call
    2.Incoming SMS
    3.Charger Intrruption etc, you have to handle all these events in the game. In order to handle this there are some different things to be take care these are as, if my memory served me correct, then in S40 devices on either of these events the control goes to the PauseApp() and in S60 the cotrol goes to the hideNotify() and when the intrrupt gone then i n S40 the control will go the startApp() and in S60 the control moves to the showNotify().

    So as soon as you encountered any of these events you have to handle the same in the above methods.What you have to do is just make the thread game loop as paused by making that variable as false and even making the thread as null.Note the store the current state of the game when intrrupt comes...and restore the game state back and start the thread..
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  13. #13
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Re: When the MIDlet is in the paused state?

    Quote Originally Posted by komomo View Post
    As I have asked, what should I do if I want to pause the game I was playing if I should not call notifyPaused()?
    You need to handle the events who can lead (and we have to manager that) the game in such a situation that we must pause the game, for example
    1. Incaoming call
    2.Incoming SMS
    3.Charger Intrruption etc, you have to handle all these events in the game. In order to handle this there are some different things to be take care these are as, if my memory served me correct, then in S40 devices on either of these events the control goes to the PauseApp() and in S60 the cotrol goes to the hideNotify() and when the intrrupt gone then i n S40 the control will go the startApp() and in S60 the control moves to the showNotify().

    So as soon as you encountered any of these events you have to handle the same in the above methods.What you have to do is just make the thread game loop as paused by making that variable as false and even making the thread as null.Note the store the current state of the game when intrrupt comes...and restore the game state back and start the thread..
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  14. #14
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: When the MIDlet is in the paused state?

    Quote Originally Posted by komomo View Post
    As I have asked, what should I do if I want to pause the game I was playing if I should not call notifyPaused()?
    Are you talking about a pause initiated by the user (selecting a "pause" option in the game), or a pause initiated by the device (because of an incoming call, etc.)?

    Graham.

  15. #15
    Registered User
    Join Date
    Oct 2009
    Location
    Noida
    Posts
    941

    Re: When the MIDlet is in the paused state?

    Quote Originally Posted by grahamhughes View Post
    Originally Posted by komomo
    As I have asked, what should I do if I want to pause the game I was playing if I should not call notifyPaused()?

    Are you talking about a pause initiated by the user (selecting a "pause" option in the game), or a pause initiated by the device (because of an incoming call, etc.)?

    Graham.
    I think Raj took the thread to another direction, Komomo wants a user initiated Pause not device initiated one. Thats why I wrote "He does'nt need to pasue the Midlet as such, but he just do a logical freeze of his game logic, game engine and timers".
    Thanks,
    Ekta

Page 1 of 2 12 LastLast

Similar Threads

  1. Some stream is paused in E71
    By icube_nt@nokia in forum General Development Questions
    Replies: 1
    Last Post: 2010-04-05, 07:26
  2. ASD Exam Paused
    By narendar_discover in forum News, Announcements and Job Listings
    Replies: 0
    Last Post: 2009-07-18, 09:24
  3. Accessing resources like file system in paused state.
    By anoopks in forum Mobile Java General
    Replies: 3
    Last Post: 2007-05-16, 20:22
  4. Way to keep app from being paused?
    By Subotai4Winds in forum Symbian C++
    Replies: 0
    Last Post: 2006-05-15, 22:14
  5. MIDlet State Change
    By cwfvanoordt in forum Mobile Java General
    Replies: 3
    Last Post: 2004-01-27, 12:52

Posting Permissions

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