Much thanks to Gustavo for the original project. Many things from this project are directly copied from his project, so be sure to go show him some love. I've made some customizations to his project to create a flawless way to use Alexa to launch Chromecast & Netflix.
What's different from Gustavo's Project?
My phone has a fingerprint lock on it. I noticed that if the phone is locked, the program wouldn't run correctly. I found a workaround that will:
- Unlocks phone so even if phone is asleep & locked the program will still run
- Doing the bullet point above will overwrite your current lock settings to pin 1111, so then we have to apply fingerprint lock back to the phone.
Here is the plan:
- Use an IFTTT recipe as the trigger when we say the phrase "Alexa, Trigger Chromecast"
- IFTTT then sends a pushbullet notification to an Android phone or tablet
- The Tasker app detects this, opens Netflix and begins casting Netflix to the ChromeCast attached to the TV
- Install IFTTT on your Android phone or tablet
- Add this IFTTT recipe to your account and activate it
This is where it starts to get tricky.
Step 2.1 - Setup
- Run each app, and be sure to enable any accessibility services or administration privileges. (Secure Settings requires Administration privileges to change your lock settings)
Step 2.2 - Creating the task
- Open Tasker, and click the "TASKS" tab on the top
- Add a new task by clicking the + symbol, and name it Netflix
- OPTIONAL: If you're like me, you turn off your WiFi when you're not home to save battery. Use tasker to make sure your WiFi is on by: Add an action by clicking the + symbol -> Net -> WiFi -> Set On
- Add an action -> Plugin -> Secure Settings -> Click the pencil icon in the top right -> Dev Admin Actions -> Password/Pin -> Click Disabled so it becomes Enabled ----------- Now, set your backup password. If you already had a pin, just click Pin and re-enter it. If you prefer a text password, feel free to do that too. --------- Click the Save icon (the floppy disk) on the top -> Click the back button (the cog in the top left) to save the action
- Add an action -> Plugin -> Secure Settings -> Pencil Icon -> Actions -> Wake Device -> 5 Seconds -> Save -> Back
- Add an action -> app -> launch app -> Netflix
- Add an action -> task -> wait -> make it wait for 2 or 3 seconds, or more if you have a slow phone. I have a Galaxy S6 and I have it set to 3 seconds.
Step 2.3 - Google cast to TV
- Add an action -> plugin -> autoinput -> action
- tap on the pencil icon in the top right
- tap on Easy Setup -> Close. this adds a notification in the notification bar and waits there for further instructions
- open Netflix
- drag down the Android notification bar and hit the AutoInput Selecting Field -> ADD button
- now AutoInput (Tasker) is waiting for you to tell it what to do
- tap on the Netflix CAST icon -> this tells AutoInput that you want it to tap on it when the task gets triggered
- select Accept in the Tasker notification that comes down from your notification bar
- select Tasker in your list of open apps
- select Element Text: Where to play
- select Action to perform: Click
- tap on the checkmark at the top right corner to accept the new autoInput action
- this brings you back to Tasker -> hit on the back button to save your new action
This action aims at automating the opening of the cast menu. Once the menu is open, you need to tell Tasker to select the Chromecast you want to stream to.
So now, repeat all the steps above to create the click on the Chromecast you want to cast to, but be sure to select "Element Text: xxxx" when you are prompted with "Select Element Field"
Step 2.4 - Removing the pesky notification
Want to remove that annoying notification automatically?
- add an action -> plugin -> AutoNotification -> Cancel -> Pencil Icon -> app name filter -> notification app -> Pushbullet -> ok -> back -> save with check mark in top right -> back to save action -> BACK AGAIN to save the entire task
Here's how the Netflix task should look
Now that you've done the above a few times, this next part should go flawless.
- Go back to the Task tab in Tasker and add a new Task named Enable Fingerprint Lock
- add an action -> app -> launch app -> settings
- add an action -> plugin -> autoinput -> action -> pencil icon -> easy setup -> close
- go to your settings and scroll down to Lock Screen & Security.
- Like before, drag down the Android notification bar and hit the AutoInput Selecting Field -> ADD button
- tap on Lock Screen & Security
- REPEAT, autoinput steps above but next have it click on Fingerprints
- add an action -> task -> wait -> 500ms (or more if your device is very slow)
- add an action -> plugin -> autoinput -> action -> easy setup -> close -> navigate back to the enter pin/password screen from last steps -> before entering your password/pin, click the Add button from the notification and click the area with the flashing cursor (the area where it would display dots) -> accept -> go back to tasker -> Element with focus -> REPLACE -> Enter the pin/password you selected earlier here -> ok -> check mark to save -> back button in top left to save action
- Repeat the autoinput steps to click the Next button, then repeat again to click the Fingerprint unlock button to re-enable fingerprint lock
- Last but not least, add an action to launch the netflix app again
- Be sure to click the back button in the top left to save!
Her'es how the Enable Fingerprint Lock task should look
Now we're almost done! just two more small steps
Now all we have to do is make the Netflix task call the Enable Fingerprint Lock task.
- Go back to your Netflix task, add an action -> task -> perform task -> click the search button (magnifying glass) in the top right click Enable Fingerprint Lock
The Tasker profile is the missing link of all this. The Tasker profile will detect the reception of the Pushbullet notification and trigger the Netflix task we created in the previous section. Open Tasker and:
- create a new Profile
- select Event -> UI -> notification
- tap on the owner application icon (a rocket?) and select Pushbullet
- hit back to save the profile
Here's how the profile should look when you're done.
You can now say "Alexa, trigger chromecast" and few seconds after you will be ready to stream.
Again, thanks to Gustavo for the original project.