Ever since Amazon released the Echo voice controlled speaker/assistant, I and many others have been hoping for it and the Fire TV to receive an update that allows the two to communicate. With the addition of new Echo IFTTT triggers last week, I’ve been able to cobble together a working proof-of-concept that gives you a glimpse of what it would be like if Amazon’s two living room products communicated with one another.
The procedure I’ll be outlining in this post is very much a proof-of-concept and not very practical. That’s why the title of this article does not start with “How to…” like most of my guides. I’ll be laying out exactly how I was able to use the Amazon Echo to launch apps on the Fire TV with voice commands, but the process is missing polish and features that would be necessary for the average person to use this implementation on a daily bases.
IFTTT, which stands for “if this then that“, is a web service that acts as a middleman to facilitate communication between dozens of different devices and services. When Amazon first integrated IFTTT triggers with the Echo, it became possible to perform any number of tasks using the Echo’s voice commands. However, the initial set of triggers, like the To-Do list trigger, lacked the elegance I wanted for custom Echo commands. Saying “Alexa, add launch Minecraft to my to-do list” in order to launch an app felt too clunky.
With last week’s addition of a new IFTTT trigger that fires when you request a song, it became possible to perform tasks with nearly 100% customized voice commands. The command must just begin with “Alexa, start….” Since the Echo will play a song from your Amazon Music Library when you say “Alexa, start [SONG TITLE]”, you can now trigger an IFTTT task by saying something like “Alexa, start vacuuming my floor” by simply uploading an MP3 with the title “Vacuuming My Floor.”
MP3s contain embedding information called ID3 tags which hold details about the song, such as the title, artist, and album name. The Echo uses the information in these ID3 tags to locate the correct song to play. For the proof-of-concept you see in the video above, I created 3 custom MP3s, one each for the Twitch, Flappy Birds, and Minecraft apps installed on my Fire TV. You can download these 3 MP3s here.
In the MP3’s TITLE ID3 tag, I entered the app’s name so that the Echo would, for example, find the Flappy Birds MP3 when I said “Alexa, start Flappy Birds.” When the Echo locates a song it responds with “[SONG TITLE] by [SONG ARTIST]” just before playing the song. I entered “Fire TV” in the MP3’s ARTIST ID3 tag because, if left empty, the Echo responds with “[SONG TITLE] by unknown”, which I didn’t think sounded as good as “[APP TITLE] by Fire TV”. In the MP3’s ALBUM ID3 tag field I entered the app’s package name and launch activity, which I’ll discuss in more detail below. As for the audio in the MP3 itself, it can be anything. Keep in mind that the MP3 will be played by the Echo once. I chose to use this confirmation beep sound effect:
With those 3 MP3’s uploaded to my Amazon Music Library, the Echo would now play them using the voice commands: “Alexa, start Twitch“, “Alexa, start Flappy Birds“, and “Alexa, start Minecraft“.
I then created an IFTTT recipe which appends the ALBUM name of all songs played by the Echo to a Dropbox file. Since I have Dropbox installed on my Mac, that file gets updated everytime the Echo plays a song. The details of the IFTTT recipe are as follows:
Now that there is a file on my Mac that gets updated whenever a song is played by the Echo, I can have my Mac monitor that file and launch the appropriate Fire TV app using the Android Developer Bridge (ADB) whenever the Dropbox file is updated. I used a Launch Daemon (launchd) to monitor the Dropbox file and execute an AppleScript whenever the file was updated. You can download my launchd property list file (plist) here. To use yourself, you’ll need to modify the path
To stop monitoring, simply run the terminal command:
The AppleScript which runs when the Dropbox file is updated is very rudimentary, and is one of the reasons why this procedure is not very practical in its current form. You can download my AppleScript here. The AppleScript executes the ADB shell command
This brings us back to the contents of the custom MP3 file’s ALBUM field. In order to launch an Android/Fire TV app via ADB, you need to know the app’s package name and launch activity. You can determine these two things using Android’s Asset Packaging Tool (appt) command line utility. An APKs package name and launch activity are listed when you run the following command:
For example, for the app Flappy Birds, the package name is
I chose to store the tail end of that command,
There are several caveats which make this procedure impractical in its current form. For starters, the AppleScript should be improved upon by having it control the ADB connection to the Fire TV. As it is now, an ADB connection between the Fire TV and the Mac must always be live for this to work. Additionally, the AppleScript should be updated to not execute shell commands when a real song is played by the Echo. My current proof-of-concept will run ADB shell commands every time the Echo plays a song. The delay between issuing a voice command and having the app launch could probably also be shortened by using a method other than Dropbox to relay instructions to the Mac. Hopefully, by the time I or someone else improves my implementation, Amazon will have released true Echo-to-Fire TV communication. I’d love to hear, in the comments below, what you think of this concept and what type of features you’d like from an Echo controlled Fire TV setup.