Developing for Amazon Fire TV devices with Xamarin and MVVM Light

.NET, Amazon Fire TV, IdentityMine, MVVM, Technical stuff, Work, Xamarin
See comments

12-Jun-14 10-48-00 AM

I am currently working on an exciting project for the Amazon Fire TV device. We at IdentityMine are (amongst other skills) experts in XBOX application development (for XBOX 360 and XBOX One) and it was only natural for us to embrace the Amazon Fire TV device in our skillset. This device runs Android V4.2.2 (API Level 17), and rather than using Java for this development project, we decided to use Xamarin.

UI and code

Because of our background in XAML/C#, picking up on Xamarin Android development was really easy. I will write more about that in the next few weeks, but basically the XML-based UI is quite close from XAML (though it is not as comfortable), the Xamarin designer helps to build the UI (it’s not as powerful as Blend, but it is quite good) and we can use styles and even inherit styles like we do in XAML too.

For the code, no big surprises here, it is standard C# and because we use the Model-View-ViewModel pattern and MVVM Light, we have been able to import a large portion of our code in no time. This will also come very handy when we do the Windows 8 version of this application. For fun, I built the home page of the app (including connecting to web services, downloading a list of items and displaying in a GridView) in less than one hour on a lazy Sunday afternoon in my garden. The Model and ViewModel layers were completely shared (it’s a portable class library).

Good to know

There is an Amazon Fire TV component available in the Xamarin component store (note: the component is free). In my experience it is only necessary if you want to use the game controller, or if you use the Amazon notification system. Even without the component, the application is running fine on the Fire TV device. Make sure to read the Getting Started document, especially the section about connecting the Android Debug Bridge.

Other documentation which I found very useful was the Amazon Fire TV documentation, which is a little bit buried in their Developer site.

Finally and obviously, the Developer site at Xamarin with all kinds of goodies.

Some tools

I wrote the following three batch files to help us with the development. Make sure to download these locally and open them in a text editor to configure them. I explain in the header what to do with those.

  • ADBFireTv.bat: Every time that you restart the Fire TV device, you need to re-configure the Android Debug Bridge (ADB). This is kind of annoying so I wrote a BAT file for that.
  • install.bat: Installs a signed APK (Android binary package) to the device. Note that it only works if you install the Release package and use the Signed one. In order to generate this package from Visual Studio or Xamarin Studio, you need to run the Release mode on the device once (with Ctrl-F5). Then the APK file will be available in the bin\Release folder.
  • screenshot.bat: This one is super useful: It takes a screenshot from the device and copies it to your computer. We use that a LOT in the polish phase of the project, when we concentrate on the design.

Hopefully you will find these few tips convenient and helpful.


Previous entry | Next blog entry

Comments for Developing for Amazon Fire TV devices with Xamarin and MVVM Light