Opening and Closing Applications
Opening and Closing Applications
Opening an Application
To run or open an application, the request has to be sent to the Application Manager. Such requests are made through the sendReadyEvent() method of the Widget object in the common module.
var widgetAPI = new Common.API.Widget(); // Creates Common module
widgetAPI.sendReadyEvent(); // Sends 'ready' message to the Application Manager
Setting the Access Point
Whenever you open an application, the browser reads the index.html file. You must register a JavaScript function in the onload property in the index.html file so that when the <body> load event occurs, the application starts. The application must call the sendReadyEvent() method of the Widget object in the common module.
<body onload="Main.onLoad();">
Closing an Application
There are two ways to close your application working on the screen:
- Press the Return or Exit button on the remote control.
- Sending an event to the Application Manager. To do this, use the sendExitEvent() and sendReturnEvent() functions of the Widget object in the common module. For more information, see Common Modules.
Preventing of closing the TV screen by the Return or Exit key
TV users can close applications using the Return or Exit key on the remote control:
- Pressing the Return key, returns users to the Application Manager
- Pressing the Exit key, returns users to the TV screen.
In order to prevent this, the blockNavigation() function of the Widget object in the common module has to be executed on pressing Return or Exit key. For more information, see Common Modules.