- Home /
Android Help - How to suspend the game during a phone call?
I was play testing my game and had my wife call me. After pressing the "Answer" button to answer the call about 10 times with no results, all of a sudden it finally answered the call. When I ended the call with the "End Call" button, my game was back on the main menu... There is nothing in my code that would make that happen. (If I had failed the level, I should've at least seen the "Game Over" screen).
So how can I properly suspend the game when I receive an incoming call and pickup exactly where I left off when the call is ended? Or even better, when the call is ended, make the player click a 'Resume' button (it's an action game so better make sure they are ready!)
rather important question, looking forward to see some answers
I just noticed on my phone that I got a notification that I actually "$$anonymous$$issed" that call... Not sure how my phone thinks I missed the call even though it did actually (eventually) connect me...
Good question. I don't have an android phone so I'm unable to test it myself.
Answer by rutter · Mar 23, 2012 at 06:10 PM
In your player settings, make sure that "run in background" is not set.
Unity will call OnApplicationPause() on all of your MonoBehaviours when the player is paused (for example, by receiving a phone call). You could use this to bring up a pause menu.
There is no "Run in background" checkbox for the Android settings. I see it for "Web Player" and "PC and $$anonymous$$ac Standalone" builds but not for Android.
I did find 'Application.runInBackground = false;' which I placed in my 'Awake()' function for my main menu AND my level 1 main script but got the exact same results.
Still need help with this ASAP!
You need free help ASAP? cool, I need money ASAP wanna swap?
Your answer
Follow this Question
Related Questions
Does the application have to suspend? 2 Answers
Unity Android Suspend/Resume and Quit behaviour 1 Answer
Restart Game on Resume (Android) 0 Answers