Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Swiping up to put an app in the background

Discussion in 'BlackBerry' started by Tomo-Games, Jan 9, 2014.

  1. Tomo-Games

    Tomo-Games

    Joined:
    Sep 20, 2010
    Posts:
    223
    How do we detect that an app has been moved to the background?

    It seems: void OnApplicationPause(bool paused) has little effect.

    and this isn't triggering either If(Input.GetKey(KeyCode.Escape)||Input.GetKey(KeyCode.Home)||Input.GetKey(KeyCode.Menu)||...
     
  2. AlexThibodeau

    AlexThibodeau

    Unity Technologies

    Joined:
    Jul 23, 2013
    Posts:
    309
    I find it interesting that OnApplicationPause wasn't working for you. I was just testing this the other day with the following code:

    Code (csharp):
    1.     void OnApplicationPause(bool pauseStatus)
    2.     {
    3.         isPaused = pauseStatus;
    4.         if(pauseStatus)
    5.             Debug.Log ("------------------------------Game has been paused!! Application.runInBackground is"+ Application.runInBackground);
    6.     }
    It worked as expected where when the game was "carded" (swiping up gesture) this would fire.

    When Application.runInBackground is set to false Update() will no longer be called while the game is in a carded state but will resume when the window is made active. If you're still having problems with this please let us know by submitting a bug report with a sample so we can look into it!

    Thanks.
     
  3. Tomo-Games

    Tomo-Games

    Joined:
    Sep 20, 2010
    Posts:
    223
    That's why my games background pause works on both iOS, and Android but not on BlackBerry.
     
  4. Weerapan

    Weerapan

    Joined:
    Jun 26, 2013
    Posts:
    8
    Hi there,
    I run in to the same problem (I think). My game doesn't pause after swiped up (both sound and game loop still running).
    OnApplicationPause never called. Any tip on how to troubleshoot or debug this?

    Thanks,
    Nox
     
  5. AlexThibodeau

    AlexThibodeau

    Unity Technologies

    Joined:
    Jul 23, 2013
    Posts:
    309
    What version of Unity are you using?
     
  6. AlexThibodeau

    AlexThibodeau

    Unity Technologies

    Joined:
    Jul 23, 2013
    Posts:
    309
    Also something potentially confusing that may be causing this. In the standalone player settings there's a checkbox for "Run in Background" this is a shared setting that BlackBerry is listening to. So if you have this checked in the standalone player settings BlackBerry WILL NOT fire the OnApplicationPause callback as it has been instructed to run in the background. In an upcoming release I've added this checkbox to the BlackBerry player settings as well so this will be overt that this setting impacts BlackBerry runtime.