Okay now AFAIK to turn off OK Google using Tasker, you can do two things. Either disable Google Assistant completely (no root) or disable OK Google detection (root). Using this task, you can either disable or enable OK Google and Google Assistant at will.
Do note that AutoVoice with OK Google integration won't work after disabling OK Google (I know it's obvious but still letting you know beforehand ). Now,
Method 1: To disable Google Assistant (no-root)
Using AutoTools Secure Settings:
Using Tasker Secure Settings:
- Go to AutoTools Secure Settings > Services > Assistant > None (To enable select <Google Assistant> )
Those of you who don't have AutoTools can use Tasker Secure settings as well:
You'll have to run two Custom Secure Settings action to Enable Google Assistant:
To Disable Google Assistant, just change the values to 0 in both the actions.
- Action 1: Go to Tasker Custom Settings > Secure > assistant (Name) > com.google.android.googlequicksearchbox/com.google.android.voiceinteraction.GsaVoiceInteractionService (Value)
- Action 2: Go to Tasker Custom Settings > Secure > voice_interaction_service (Name) > com.google.android.googlequicksearchbox/com.google.android.voiceinteraction.GsaVoiceInteractionService (Value)
Method 2: To disable OK Google (root)
To disable OK Google, run this command shell in tasker with root:
To enable OK Google, replace disable with enable. You can still use google assistant from your google app.
- pm disable com.google.android.googlequicksearchbox/com.google.android.voiceinteraction.GsaVoiceInteractionService
You can use this task to either enable or disable Google Assistant or OK Google. Just make sure to run any one IF loop at a time.
Another method is to toggle the enable/disable OK Google option by using AutoInput. That'd take about 4 actions in tasker. (I've not include this in the task)
Also If you're rooted, you can use the pm grant/revoke commands to grant or deny the microphone permission to your google app. The command for this is:
(Use grant instead of revoke to grant permission. The general syntax for the command is < pm grant/revoke [package name] android.permission.[permission] >)
- pm revoke com.google.android.googlequicksearchbox android.permission.RECORD_AUDIO
EDIT: Suggested Method for devices Without Root : It seems that sometimes after disabling Google Assistant using either of the non-root methods, a black overlay still pops up even after opening the google app once after running the task. So the best way to disable OK Google hotword detection is by disabling it in the Google app itself. You can use this task to achieve this. I've combined Joao's Exit App task with AI to do this. It takes less than a second to run this task.
Note: This profile does not stop Google from recording in the background or rather *ahem* eavesdropping *ahem* on you. This will only disable the voice assistant from popping up when you say OK Google.
P.S. While using either the Tasker or the AutoTools method to disable Google Assistant, sometimes when you say OK Google a translucent black overlay pops up. This is google trying to run it's voice assistant. From what I've found, this can be prevented by opening your google app once after disabling Google Assistant using tasker. You don't have to do this while enabling GA back or while enabling/disabling OK Google using the command method.
Feel free to post any other method that you use or are aware of to disable OK Google.