<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
<link rel="self" type="application/atom+xml" href="https://developers.smarttv-alliance.org/forum/feed.php?f=6&amp;t=342" />

<title>developers.smarttv-alliance.org</title>
<subtitle>Developers forum</subtitle>
<link href="https://developers.smarttv-alliance.org/forum/index.php" />
<updated>2015-09-01T01:28:10-07:00</updated>

<author><name><![CDATA[developers.smarttv-alliance.org]]></name></author>
<id>https://developers.smarttv-alliance.org/forum/feed.php?f=6&amp;t=342</id>
<entry>
<author><name><![CDATA[aisaia]]></name></author>
<updated>2015-09-01T01:28:10-07:00</updated>
<published>2015-09-01T01:28:10-07:00</published>
<id>https://developers.smarttv-alliance.org/forum/viewtopic.php?t=342&amp;p=644#p644</id>
<link href="https://developers.smarttv-alliance.org/forum/viewtopic.php?t=342&amp;p=644#p644"/>
<title type="html"><![CDATA[Re: Handling Back]]></title>

<content type="html" xml:base="https://developers.smarttv-alliance.org/forum/viewtopic.php?t=342&amp;p=644#p644"><![CDATA[
Hi,<br /><br />You need to register a 'keydown' event listener:<br /><br /><dl class="codebox"><dt>Code: </dt><dd><code><br />window.document.addEventListener(&quot;keydown&quot;, keyDownHandler, false);<br /><br />function keyDownHandler(event) {<br />   switch(event.keyCode) {<br />      case KEY_LEFT   :  break;<br />      case KEY_RIGHT : break;<br />      case KEY_UP       : break;<br />      case KEY_DOWN  : break;<br />      case KEY_ENTER : break;<br />      case KEY_BACK  : processBack(); break;<br />   <br />      case KEY_PAUSE : break;<br />      case KEY_PLAY  : break;<br />      case KEY_STOP  : break;<br />      case KEY_RW    : break;<br />      case KEY_FF    : break;<br />         <br />      default: return;<br />   }<br />}<br /><br />function processBack() {<br />   if (myplatform&#91;\&quot;manufacturer\&quot;&#93; == \&quot;LG\&quot;) {/* YOU NEED TO DETERMINE THE PLATFORM */<br />      if(window.NetCastBack) {<br />         window.NetCastBack();<br />         //window.NetCastReturn(KEY_BACK); // &lt;- OR THIS<br />      }<br />   }<br /><br />   // Smart TV Alliance<br />   if(typeof SmartTvA_API !== undefined) {/* YOU'D EXPECT THIS TO WORK FOR ALL, BUT IT DOES NOT */<br />      try {<br />         SmartTvA_API.exit();<br />      } catch(e) {}<br />   }<br />         <br />   window.close();<br />   window.history.back();<br />}<br /><br /></code></dd></dl><br /><br />Hope it helps.<p>Statistics: Posted by <a href="https://developers.smarttv-alliance.org/forum/memberlist.php?mode=viewprofile&amp;u=5332">aisaia</a> — Tue Sep 01, 2015 1:28 am</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[edunn_1]]></name></author>
<updated>2015-06-30T10:22:02-07:00</updated>
<published>2015-06-30T10:22:02-07:00</published>
<id>https://developers.smarttv-alliance.org/forum/viewtopic.php?t=342&amp;p=461#p461</id>
<link href="https://developers.smarttv-alliance.org/forum/viewtopic.php?t=342&amp;p=461#p461"/>
<title type="html"><![CDATA[Handling Back]]></title>

<content type="html" xml:base="https://developers.smarttv-alliance.org/forum/viewtopic.php?t=342&amp;p=461#p461"><![CDATA[
I'm sad nobody seems to know the answer to this question.<br /><br />I see there's this code:<br /><dl class="codebox"><dt>Code: </dt><dd><code>function processBack() <br />{<br />if (myplatform&#91;\"manufacturer\"&#93; == \"LG\")<br />{<br />if(window.NetCastBack) <br />{<br />window.NetCastBack();<br />}<br />}  <br />} </code></dd></dl><br />But I don't understand how or where this actually gets called via button press.<p>Statistics: Posted by <a href="https://developers.smarttv-alliance.org/forum/memberlist.php?mode=viewprofile&amp;u=6493">edunn_1</a> — Tue Jun 30, 2015 10:22 am</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[edunn_1]]></name></author>
<updated>2015-06-18T11:45:24-07:00</updated>
<published>2015-06-18T11:45:24-07:00</published>
<id>https://developers.smarttv-alliance.org/forum/viewtopic.php?t=342&amp;p=457#p457</id>
<link href="https://developers.smarttv-alliance.org/forum/viewtopic.php?t=342&amp;p=457#p457"/>
<title type="html"><![CDATA[Handling Back]]></title>

<content type="html" xml:base="https://developers.smarttv-alliance.org/forum/viewtopic.php?t=342&amp;p=457#p457"><![CDATA[
I have a question about how to get the back button to quit the app back to the live TV.<br /><br />Do I map commands to function keydownhandler(e)?<br /><br />Additionally, when do I use SmartTvA_API.exit(); ?<br /><br />My need is when back is pressed, I save some data about the current video time code to localstorage, I'm just not sure how to grab the back command.<br /><br />In the sample video player app, I don't see any mapping of an exit or back command, but on the emulator, I'm able to return to the first page of my two-page app. When I'm sitting on the index file (the first page of the 2 page app) the back button doesn't return me to the TV app menu. I'm confused where and how the back button gets defined.<br /><br />Thanks so much for your help.<p>Statistics: Posted by <a href="https://developers.smarttv-alliance.org/forum/memberlist.php?mode=viewprofile&amp;u=6493">edunn_1</a> — Thu Jun 18, 2015 11:45 am</p><hr />
]]></content>
</entry>
</feed>