Search code examples
javascripthtmlamazon-fire-tv

How can I get the Amazon Fire TV Serial..?


I am developing an app (web app) for Amazon Fire TV. I need to use unique authorization for each and every app.

To do that I am trying to use the Amazon Fire TV serial. But I don't know how to get that serial (using JavaScript). If it is possible to get the serial, what is the way to get that serial using JavaScript..? I searched for this but I couldn't found any.

Thanks & Regards


Solution

  • As far as I know you can't get that from Javascript. For my HTML based app I use the following to get a number of handy piece of info about the device my FireTV app is running on, and then pass it over the JavaScript bridge to the webpage. The last item is the device serial number:

    Log.v(TAG,Build.MANUFACTURER + " " + Build.MODEL + " " + Build.DEVICE+ " " + Build.VERSION.INCREMENTAL + " " + Build.SERIAL);
    

    to pass the info into the app I use:

    webView.addJavascriptInterface(new JavaScriptInterface(this), "Android");
    

    to set up the bridge from the Java host to the webview and then

    webView.loadUrl("javascript:document.getElementById(\"dsn\").innerHTML='"+Build.SERIAL +"';");
    

    to pass the data to the element where I want to display it (though you could do anything you need