'Closing the app in samsung smart tv

I am a beginner to the samsung smart tv app development. I want to close my app on click of exit button. I used the code like this

case tvKey.KEY_EXIT:
    var widgetAPI = new Common.API.Widget(); 
    widgetAPI.sendExitEvent();
    break;

It is not closing my app. Can anyone help me to fix this issue



Solution 1:[1]

Please Check whether u have following links in the header of your page

<!-- Common widget API -->
    <script language="javascript" type="text/javascript" src="$MANAGER_WIDGET/Common/API/Widget.js"></script>
    <script language="javascript" type="text/javascript" src="$MANAGER_WIDGET/Common/API/TVKeyValue.js"></script>
    <script language="javascript" type="text/javascript" src="$MANAGER_WIDGET/Common/API/Plugin.js"></script>       

One more thing, if you want to simply exit on the press of exit button then you dont have to code any thing as by default pressing exit button will exit the app on the tv, but you can override this functionality by blocking the default exit functionality

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 abhi