Learn how to debug your Smart TV applications using free tools available in the web like JSConsole! an easy and fast solution.
There is little to no support for debugging your apps on the current Smart TV platform (codename Orsay). Sure you could use the official Smart TV emulator to display the current state of your app, but that is troublesome and slow.
Using alerts to display the current status of your app should not be an option.
Whether you’re using the Smart TV emulator or a web browser to manage the development of your app, at one point you’ll want to do conclusive testing on the actual TV set. The problem lies when you start noticing that the code you already wrote and tested doesn’t behave the way you expected it to on the Samsung device but still works with everything else! What then? The TV does not have a console, and you will probably want to avoid printing the results on screen.
A solution would be to use a remote console to display all the messages your app is displaying. With jsconsole, remote debugging becomes simple and straightforward to use. This is how it’s done:
Navigate to jsconsole.com. You will see the following screen:
The command line is located at the very top where you will be able to type simple commands (load, listen, clear, history, about). To start a remote debugging session, type listen?? on the command line:
After doing so, jsconsole will generate a <script> tag:
The following script tag should be copied and pasted to your main page (usually to index.html):
<!DOCTYPE html> <html> <head> <script src="http://jsconsole.com/remote.js?4074218D-E58C-41E6-819B-FCAC2FDF3E7D"></script> </head> <body> <h1>Hello! anyone there?</h1> </body> </html>
That’s all there’s to it! Now you can launch your app on the browser, Smart TV emulator or the TV device to see results:
In the next tutorials, we will talk a bit about console.re which prevents this issue.