Jump to content

Avert Refresh in Phonegap Game after iOS re-awakens it


mwatt
 Share

Recommended Posts

I tried to say it all in the title, but probably didn't say it well.  Here's my story.

 

I have a Phaser game developed for iOS with Phonegap.   When the OS puts the game to sleep after a time or if multi-tasking switches away from the game, the game completely reloads when it is "brought back" by the user.

 

This is unwanted by me.  The game has a menu state and a game state.  If it goes to sleep in the game state I want it to come back in the game state.  What happens however, is that the game reloads as if it were completely restarted (I suppose that is what is happening actually) and I end up in the initial state, the menu state.  I want it to come back to the game state if it went to sleep in the game state.

 

I hope this is clear.  Any suggestions?

Link to comment
Share on other sites

It's been a while since I used Phonegap but I think this has to handled by its own Pause and resume events. IE your game needs to save its current position in pause and then rebuild it when resumes. I' not 100% sure that there' s not a better way than this so have a read around before committing too much time to it.

http://docs.phonegap.com/en/4.0.0/cordova_events_events.md.html

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...