2

I am trying to send key codes to a samsung smart tv using UPnP. I found the list of available key codes here. But How can i represent the same in integer, because samsung wants to receive this as integer values in the UPnP services.

Thanks

Zach
  • 9,989
  • 19
  • 70
  • 107

2 Answers2

2

You can use the emulator to get a list of the key codes:

tvKey = new Common.API.TVKeyValue()
for(key in tvKey) {
  alert(key+": "+tvKey[key]);
}

Not a great solution, but might work for your purposes.

brimil01
  • 705
  • 5
  • 6
1

Here you have manual way. So pressing any button on remote give you info what int value it has:

$('body').keydown(function(event) {
  var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
  alert("You pressed: " + keyCode);
}
Adam Lukaszczyk
  • 4,898
  • 3
  • 22
  • 22
  • Hi Thanks for you reply. I am trying to sendkeycode from my android phone. I think this piece of code is to be implemented as a samsung smart tv app right? How can I do this code? Can you please give some inputs. Thanks – Zach Sep 17 '12 at 08:28
  • 1
    Here you have info how to create your first app: http://www.samsungdforum.com/Guide/View/Developer_Documentation/Samsung_SmartTV_Developer_Documentation_3.5/Getting_Started/Application_Development_Process/Implementing_Your_Application_Code/Coding_Your_JavaScript_Application You need to add jQuery, and then paste my code snippet somewhere in the code. – Adam Lukaszczyk Sep 17 '12 at 11:09