Book Image

PhoneGap for Enterprise

By : Kerri Shotts
Book Image

PhoneGap for Enterprise

By: Kerri Shotts

Overview of this book

Table of Contents (16 chapters)
PhoneGap for Enterprise
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Handling changes in the application state


Your app almost certainly won't be the only app running on the user's mobile device. As such, the app needs to properly handle being backgrounded and then later being resumed by the operating system. The app should also have a strategy in place to deal with unexpected terminations as the operating system (or the user) might terminate any app at will.

The pause event is fired when the app is being placed in the background by the user or by the operating system. The resume event is fired when the user or the operating system brings the app back to the foreground. Note that there is no guarantee that your app will receive a resume event after a pause event; the operating system might terminate the app instead. In this case, the app will restart from the beginning with no resume event received.

The ideal situation is that the app will be paused for a short time and then resumed shortly thereafter. In this case, there's no need to worry about saving the...