×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Regular Contributor
    Join Date
    Nov 2008
    Posts
    92

    Question Returning from background

    Hi all,

    I'm developping an application to S60, more specific Nokia N81.
    I need the app can be able to run in background.
    So, I did the methods like that:
    Code:
    public void minimize() {
        paused=true;
        display.setCurrent(null);
    }
    
    public void maximize() {
        paused=false;
        display.setCurrent(myCanvas);
    }
    The app calls maximize method like that:
    Code:
    protected void startApp() {
        if (paused) {
            maximize();
        } else {
            initApp();
        }
    }
    However, when the app is maximized again, my Canvas nevermore calls paint method.
    Is the code above correct?

    Thanks!

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

    Re: Returning from background

    Are you sure startApp() is being called when you think? Many devices call startApp() only once.

    Graham.

  3. #3
    Regular Contributor
    Join Date
    Nov 2008
    Posts
    92

    Re: Returning from background

    If your app is opened and you receives a sms or a call, the system calls pauseApp(). When you return to the app, the system calls startApp() again. As far as I know, this occurs in all devices.

    But I don't know if this occur when the app returns from background.

    That is my question.

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

    Re: Returning from background

    Quote Originally Posted by fabiocberg View Post
    If your app is opened and you receives a sms or a call, the system calls pauseApp(). When you return to the app, the system calls startApp() again. As far as I know, this occurs in all devices.
    I can offer you a 100% guarantee that this most certainly does not occur in many devices, including the majority of Nokia devices.

    If I was you, I'd check my assumption...

  5. #5
    Regular Contributor
    Join Date
    Nov 2008
    Posts
    92

    Re: Returning from background

    Quote Originally Posted by grahamhughes View Post
    I can offer you a 100% guarantee that this most certainly does not occur in many devices, including the majority of Nokia devices.

    If I was you, I'd check my assumption...
    See this article by sun following:

    The remaining methods directly affect the MIDlet's life-cycle. A paused MIDlet calls resumeRequest() to be reactivated. An active MIDlet calls notifyPaused() to be deactivated. A paused or active MIDlet calls notifyDestroyed() to be destroyed. Note that resumeRequest() merely asks the AMS to reactivate the MIDlet; the AMS decides whether and when to reactivate the MIDlet. Reactivation invokes the MIDlet's startApp() method. By contrast, notifyPaused() or notifyDestroyed() causes an immediate transition to the new state; as a consequence, neither pauseApp() nor destroyApp() is invoked.

    From: http://developers.sun.com/mobility/m...ticles/models/

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

    Re: Returning from background

    I'm familiar with the specification. Nowhere does it require an implementation to call pauseApp() ever. Nor is there any requirement for specific processing in the case of an incoming call, SMS, or other external event causing the application to be pushed into the background.

    Are you using notifyPaused() and resumeRequest() to switch your MIDlet back and forth?

    Graham.

Similar Threads

  1. Custom item background: Paint it black?
    By Yuriy in forum Mobile Java General
    Replies: 7
    Last Post: 2010-05-13, 06:12
  2. [moved] J2me polish background image problem
    By poojs in forum Mobile Java Media (Graphics & Sounds)
    Replies: 3
    Last Post: 2009-05-25, 11:42
  3. J2me polish background image problem
    By poojs in forum Feedback - Nokia Developer Services & Infrastructure
    Replies: 1
    Last Post: 2009-05-25, 07:08
  4. How to make the background of a Custom Canvas Transparent
    By markchua_99 in forum Mobile Java General
    Replies: 4
    Last Post: 2008-09-30, 02:57
  5. returning from background
    By putek20 in forum Symbian
    Replies: 0
    Last Post: 2003-11-27, 09:09

Posting Permissions

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