Launch Android app by http request?

I’m trying to figure out a way to launch a specific app on my Fire TV by using an HTTP request from CoRE. I have a Windows machine set up as a local web server already for a few other integrations, would love to be able to set up an additional node session that would issue an ADB command via command prompt when it received an HTTP request from SmartThings/CoRE. Anyone know of something? I’ve been searching for hours and can’t come up with a good solution, and I’m not familiar enough with any programming language to make my own.

1 Like

By chance do you can a harmony hub?

Yes…

10 characters

Thanks for the idea. I’m trying to launch videos and/or apps by voice with no other interaction required, so unfortunately it won’t help with what I’m trying to do.

I have Kodi installed on my Fire TV. Got it set up for external control via HTTP request. Using Google Home, IFTTT, and CoRE I can start a video playing by voice command. The caveat right now is that I have to have Kodi running first before I can use the voice command, which takes away from the hands-free idea. I can launch Kodi on FTV with an ADB command from another computer on my network. The idea was to start a web server on that computer and have it run the ADB command automatically when it received a web request from CoRE, then a couple seconds later send the command to start the video.

I found a couple of node.js-based ADB packages, and found several standalone web server packages. Was able to get them up and running individually, but I lack the knowledge to put the two together.

I also found something Python-based that looked promising but I couldn’t figure out how to get all of it’s dependencies loaded, it looked mostly Linux-based and I’m on a Windows machine.

But why not have Alexa pass the harmony command to FireTV to launch app A and then add your CoRE function to that?

Can you share your CoRE piston?

You have Sharptools/Tasker, right? Have you tried that route?

You cannot load a program on a FireTV through an HTTP request. Wish they supported that, wanted to use my harmony remote to autostart a netflix, HBO or SPMC(Kodi).

That is why you need to make an ADB call which the python method should work on windows. You would still need to create a device handler and smartApp in smartthings.

Do you have a Harmony remote? With the new FireTV layout you have a “Favorite Apps” section that you can order certain apps. I was thinking of doing something like this to map certain apps to load. Its not magical, it relies on remote presses, but should get the job done.

Can an Echo/Echo Dot launch apps on a Fire TV? I’m aware of the remote’s voice capability, but since I have a Harmony, the stock FTV remote is tucked away somewhere. Plus, if I have to track down a remote before issuing voice commands it takes away a lot of the appeal of voice launching.

The piston is just set up to receive a Maker IFTTT web request as the condition and send an internal GET web request to Kodi (after Kodi is already running) as the action. Nothing special or very complicated. I started playing with passing variables back and forth but if I can’t get it to also launch Kodi a lot of my motivation goes away.

Not yet, I saw there was a Harmony plugin for Tasker but I haven’t messed with it yet. It didn’t have too many good reviews from what I saw. I think I’ve hit a dead end with my server-based searching, so that may be next.

Correct, I have no interest in installing programs remotely, I mean that I want to launch an app by voice. I have successfully done this with ADB from a remote computer. No DTH or smartApp necessary if I can find some sort of bridge between a web server and command prompt, it would just use ST/CoRE as the gateway to go from an external web request (Maker → CoRE) to an internal one (CoRE → web server).

I do have a Harmony remote, but again, the idea is to do this by voice and not require button presses at all. I don’t mind scrolling through a (short) list of apps if I already have the remote in my hand.

I just spent about 6 hours trying to figure out how to install that python method on my Windows machine, there’s tons of dependencies that were built for Unix/Linux or whatever and aren’t directly compatible. I’ve been finding workarounds for several hours and finally hit a roadblock with a method that Windows doesn’t seem to support and gave up.

Yes that’s what I’m doing I’m using my Alexa to launch apps that are set up as activities with keyboard commands on my Android TV. Since fire TV it’s just a fork version of android you can be done there too.

So I say Alexa turn on Netflix Nexus. This turns on my TV my AV puts the AV on the correct input then launch is Netflix on the Nexus player device.

AHHHHH DUHHHH I just realized what both of you were getting at…with the new FTV layout I can add keypresses to the activity startup sequence to launch Kodi when the activity starts. I wish I had my 6 hours back from earlier today :scream:

3 Likes

Well after about 30 minutes of setting up and tweaking I have it working. Thanks guys.

@BBoy486 here’s the inner workings:

IFTTT applet (GH trigger, CoRE endpoint)


CoRE Piston to receive web request, set variables, and make web request to Kodi. The @movie_title variable and the @kodi_ip variable are set as part of the incoming IFTTT request. The “immediately set variable” portion I am using to convert the incoming @movie_title plain text to url encoding. Because I’m storing my media files on a SMB share I have to URL encode the remote path when sending to Kodi, there’s a limitation in the CoRE code that keeps me from sending anything with multiple “://” instances through in a URL. Anyone storing files locally rather than through a remote drive may be able to skip this part if they set their file names up correctly. Also, I’m sending the IP address from the IFTTT applet because I plan to eventually set the same thing up on our second Fire TV in the master bedroom, so there will be a second IFTTT applet that refers to that FTV’s IP instead.

Living Room Kodi is a Harmony Activity that starts Fire TV and does the necessary button presses to launch Kodi. I have another piston that turns on my normal Fire TV activity when the Kodi activity turns on, so it switches back to “normal” after this all runs.

I would like to do this with Alexa but it seems I can’t use a $ character in IF.

I haven’t done this before (looks cool) would love to do this with Plex.

This is a silly question but are you having CoRE have a piston for each one of your movies e.g. Despicable Me?

There’s a few ways to do it with Alexa, but each one will require it’s own applet in IFTTT. You could hit different CoRE endpoints with each one, which would require a separate piston for each request, or you could hit the same endpoint with each applet and pass the move title through as a part of the Body. Doing this would allow you to use a single CoRE piston, like I did.

Since I’m storing my files on a SMB share I have to convert the plain text @movie_title variable to a URL encoded path. There’s a limitation in CoRE that checks for multiple instances of the “://” string in a URL and errors out if there are more than one. SMB requires a file path in the format smb://xxx.xxx.xxx.xxx, so I have to work around that. If you are storing your files on the same device that Kodi is running on you might be able to skip this step, which would make things a lot easier. I have to add an action for every movie title in my library, but if you could simply pass the value that IFTTT sends straight through to the file path, you might not have to do this.

Here’s my single piston with all of my daughter’s movies set up:

Here to help.

Set it up for to auto launch apps from the activity buttons and it works surprisingly well. Its really quick.

I use Emby to manage my media in Kodi. Seems like they have an API and you can trigger remote play from the browser. Might be another option.

1 Like