question

newuser-98fe1cc3-8b5c-4a68-840d-9e321bcbe0c2 avatar image
newuser-98fe1cc3-8b5c-4a68-840d-9e321bcbe0c2 asked ·

How to identify Amazon Fire TV and Fire Stick in code level (HTML/JavaScript) ..?

I have developed a Fire TV application using HTML5 and JavaScript. That app is for Amazon Fire TV and Amazon Fire Stick. I need to identify what is the currently accessing device. Either Amazon Fire TV or Amazon Fire Stick.

How can I do this using HTML/JavaScript..?

Thanks

fire tvtestingapp
10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Jamie@Amazon avatar image
Jamie@Amazon answered ·

This should be able to help., so you can check it at the required level.

10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Jacek avatar image
Jacek answered ·

Thanks Jamie, that helps on the server side!

Is there a way to get that info in the app built using Web App Starter Kit? Are those strings somehow accessible as well?

10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Joseph Shelby avatar image
Joseph Shelby answered ·

My code in SubFire is attached. I'm not picky about version numbers, as I have some degree of 'feature detection' in my code to determine that the WebKit version is old and I have to insert certain hacks for the audio tag.

var ua = navigator.userAgent;
if (ua.indexOf('cordova-amazon-fireos')>=0) {
  window.isFire = true;
  if (ua.indexOf('; AFT') >=0) {
    window.isFireTV = true;
  } else {
    window.isTablet = true;
    window.isKindleFire = ua.indexOf('; KF') >=0;
    window.isFirePhone = ua.indexOf('; SD4930UR') >= 0;
  }
}
1 comment
10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Thank you Joseph, that was exactly what I was looking for!

0 Likes 0 ·