Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User alexey_kr's Avatar
    Join Date
    Mar 2005
    Posts
    5
    Hi, friends !

    Sorry for my english ...

    I following trouble:
    1) I have a Form as a main game menu
    2) After user select play game the Display.setCurrent(gameCanvas) is called. It is possible what after this and before the gameCanvas.showNotify() the incomming call occur and system screen appear. It is time to set pause in game, but because pauseApp() not called in Nokia phones and because gameCanvas.hideNotify() not called too, detect the pause is impossible !!!

    I check in emulator - the notifyHide() not called if incomming call occur before canvas became truly visible. The showNotify() called when system screen dismissed.
    That became a big trouble on 40 series. Because if I accept incomming call, the system screen dismissed and my canvas became visible (the showNotify() called). The game begin because pause can't be detected.

    Is any workaround posible ?

    Best regards, Alexey !

  2. #2
    Regular Contributor alex_crowther's Avatar
    Join Date
    Aug 2003
    Location
    uk
    Posts
    232
    My solution is to only monitor hideNotify().

    When hideNotify() is called, pause your game, don't change the display at all, JUST pause the game.

    When the phone call ends the user can unpause the game themselves rather than having the game unpause automatically.

    The only complication, is you need to work out which hideNotify() events you are causing (going to from game to menus for example) and which are created by incoming calls.

    My advice is have a function for changing the display which sets a global variable to true which hideNotify() can check to see if its an event you created.

    Lastly, you can only detect a call on a canvas (on nokia phones), while the display is set to a List or Form etc its not possible at all.

  3. #3
    Registered User alexey_kr's Avatar
    Join Date
    Mar 2005
    Posts
    5
    Thank you for your reply !

    Originally posted by alex_crowther

    ...
    The only complication, is you need to work out which hideNotify() events you are causing (going to from game to menus for example) and which are created by incoming calls.

    My advice is have a function for changing the display which sets a global variable to true which hideNotify() can check to see if its an event you created.

    I use a little another approach:


    public void notifyHide() {
    if(this != Display.getDisplay(midlet).getCurrent()) {
    // It is midlet's displayable switch
    } else {
    // It is switch to system screen
    }
    }


    I check on emulators - that work, but your solution with variable a more clean because not so dependent to implementation of MIDP on devices.


    Lastly, you can only detect a call on a canvas (on nokia phones), while the display is set to a List or Form etc its not possible at all.
    Yes ! And that is exact trouble I notice. Because if incoming call occur when midlet initiate switch to canvas from any "native" GUI screen. The notifyHide() not called for that GUI screens and - that important !- the hideNotify() not be called for "incoming" Canvas. In fact even showNotify() will be called only after system screen dismissed. That all - we can't detect pause in this case Is it ?

  4. #4
    Regular Contributor alex_crowther's Avatar
    Join Date
    Aug 2003
    Location
    uk
    Posts
    232
    You seem to have lost me in a cloud of dodgy english

    You might do better if you use google translate to translate from whatever your native language is. Then again ..

    So long as your incoming call detection works most of the time, and it cannot leave the midlet in an unusable state (i.e. paused with no unpause available), I wouldn't worry.

    Wait until you try programming for samsung phones, an incoming call on a samsung phone doesn't call any methods at all.

    The only way you can detect it happened is to keep calling System.currentTimeMillis() and look for a sudden jump forwards in time of greater than say 5 seconds ...

  5. #5
    Registered User alexey_kr's Avatar
    Join Date
    Mar 2005
    Posts
    5
    Thank you ! I will try do maximum I can to detect pause

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved