×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    May 2004
    Posts
    4

    The game for Vodafone does not pause no incoming call.

    Hi, I am facing trouble with S60(7650/3650/6600) and S40(7210/3200) that our game does not pause when I received incoming call or message. I have programmed as Vodafone defines on their criteria, but this still does not work.
    Actually, other non-Nokia MIDP games are working alright
    with same code. Does Nokia handset have some special
    configuration for it? Can anyone help us?

    Thank you in advance.

  2. #2
    Regular Contributor
    Join Date
    Aug 2003
    Location
    uk
    Posts
    232
    Pausing works differently on different handsets.

    For nokia you can only detect a call if the display is set to an instance of Canvas.

    hideNotify() and showNotify() will be call.

    Be aware: these methods are call at other times as well though.

    For most phones (but not nokia or samsung), the midlet methods startApp() and pauseApp() will be called.

    On samsung phones (well E710 anyway), nothing is called, the running java virtual machine is just suspended.

    Samsung phones require your game to have a special hack if you use System.currentTimeMillis() in your game.

    The reason for this is, while the game is suspended, time continues to pass, and once the game is resumed, the time as reported by System.currentTimeMillis() will jump by the time the game was suspended. If like me you use System.currentTimeMillis() for timing/speed control of your game, this will kill it.

    The solution is to use a virtual time function, this solves several problems (e.g. how to pause the game) in one swoop.

    My time function is below:

    Code:
    // notes: #ifdef is a cpp (C preprocessor) directive.
    // notes: GetGameTime() must be called at least once a frame.
    
    private static long		gameTime;
    private static long		gameTime_lastCall;
    
    public static long GetGameTime()
    {
    	long iCurTime	= System.currentTimeMillis();
    	long iTimeJump	= iCurTime - gameTime_lastCall;
    	
    	#ifdef SAMSUNG_BUILD
                      // if time skip of 3 sec or more, then pause
    		if (iTimeJump > 3000)
    			theEngine.setPause(true);
    	#endif
    	
    	// if not paused than increment time
    	if (!bGamePaused)
    		gameTime += iTimeJump;
    	
    	// this must be updated every time, if it is not updated
    	// when paused, time will jump when you unpause
    	gameTime_lastCall = iCurTime;
    	
    	return(gameTime);
    }

Posting Permissions

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