Initialize – Every time an app gets shown on screen, it starts with loading the web page. This is where you would initialize your app to be shown on screen.
Ready to Show – Once an app is ready to be shown on screen, the start method should be called:
This will let the Player know that the app is ready to be shown on screen. However, this does not guarantee that your app will be shown on screen immediately.
On Screen – If necessary, you can attach a promise to the start call. This promise will resolve when the app is shown on screen. In almost all cases this is something you will want to do. Once the app is on screen, this would be the time to start timers, animations, etc.
If you need to take the app offscreen at anytime, call the hide method:
When saving an asset, if the property showDuration is set to false on the options object, you will need to call hide before the application is going to be destroyed. Otherwise, the app will stay onscreen for the saved duration and automatically is taken offscreen
To prevent your app from being interrupted by another application and taken offscreen, call the following method and and pass in false as an argument:
Once your ready for the app to be taken offscreen, set it back to true:
Destroy – When the app is being taken off screen, the Player will fire off a destroy event. If you have a listener attached to this event, it will be called at this time. This is useful for saving app state so that when the app is next initialized, you can continue playing where you left off. Whatever code is executed inside of the destroy event must be executed quickly, you only have one second to call the done() function before the app is considered frozen and put into an error state. Read more about Application Status API.