Ever since I started being able to talk to my Android phone, I’ve wanted to be able to tell it to lock my screen. And ever since then, Google Assistant has stubbornly refused to do it. I can’t imagine why Google hasn’t implemented this feature; they obviously know people want it, since when you ask Assistant to lock your screen it recognizes the request and tells you it can’t.
Today, however, I realized that with this, as with so many other things that Android doesn’t have built into it but should, I can bridge the gap with Tasker. Tasker is an incredibly flexible Android automation app which I’ve used to automate many things over the years.
Here’s how to use Tasker to allow you to lock your screen with your voice, and how to avoid the various gotchas I ran into while figuring this out.
I am assuming here that you have basic familiarity with Tasker, if not, go and learn, and come back when you’re ready to proceed.
Tasker has a Google Assistant integration built in. Basically, you can say “OK Google, run task name in Tasker”, and Google will tell Tasker to run the task with that name. See the documentation for more details. However, there are two gotchas:
- It doesn’t always work when the Tasker app or Assistant is already open when you try to use it. Make sure you’re on your home screen or in a different app.
- Sometimes the name of a task can confuse Assistant into doing something other than sending the task to Tasker. To avoid this, you can give the task a silly name that Assistant won’t confuse with another action. As I explain below, you won’t actually have to say that silly name to activate the task, though you can if you want.
The first thing to do is create a task in Tasker called “Stroganoff” containing the “Display / Turn Off” action with the “Lock” checkbox enabled.
After doing that, tapping the check-mark to activate the changes, and returning to your home screen (because of the gotcha mentioned above), you can say “Hey Google, run Stroganoff in Tasker” and your screen will lock. Mission accomplished!
However, let’s be a bit more clever and set up a “routine” in Assistant so you can use more intuitive phrases to lock the screen. Here’s how to do that:
- Open the Google app, tap your avatar and select “Settings”, “Google Assistant”, and then “Routines”.
- Tap “New” to create a new routine.
- Tap “Personal”.
- Tap “Add starter”.
- Tap “When I say to Google Assistant”.
- Add all these phrases: “Screen off”, “Turn off my screen”, “Lock my screen”, “Turn my screen off”, “Lock screen”.
- Tap “Add action”.
- Tap “Try adding your own”.
- Enter “run Stroganoff in Tasker” in the text box.
- Save everything.
That should do it! If you say “OK Google” or “Hey Google” followed by any of the phrases above, your screen should lock.
Share and enjoy!
how can I get this to work if the screen is off? I can’t get Google assistant to run a Tasker task if the screen is off
Doesn’t your screen turn on when you say “Ok Google” or “Hey Google” at the start of the command?