The difference between Return and Exit keys
Policy for Return and Exit keys behavior
Policy
There are two basic keys which default action is to exit the app: the Return and Exit keys. The main difference between them is as follows:
- Return key - returns to the SmartHub main page.
- Exit key - returns to the live TV signal.
If you don’t define any Return and Exit keys handling in your code, both of these buttons will work automatically as described above. However, it is strongly recommended that if application has several depth levels, the Return key would take back to the previous application level. Only when the main screen is reached, it should close the application completely and open the SmartHub window.
API for general apps
In order to handle both of these keys in the correct way, you can use the following functions of the Common Widget Object:
- blockNavigation()
- to prevent the default key behavior
- sendReturnEvent()
- to close the application and return to SmartHub
- sendExitEvent()
- to close the application and return to broadcast signal
API for Application Framework apps
If your application is built using the Framework, you can still use the API above. However, the Framework core includes integrated API for the same functionalities, so the same behavior can be implemented without including any additional files.
The Framework API for blocking default key functions and application exit are as follows:
- sf.core.exit()
- to close the application - the landing screen depends on the boolean parameter value
- sf.key.preventDefault()
- to block the default key behavior
See also
- User experience in game applications
- Return and Exit key policy for game apps