force ok google when screen off

Voice commands and digital assistants are the new faces of the smartness in smartphones. Operating your smartphone with voice commands is quite useful, and it’s also pretty cool. You can just say a magic word, and it opens Google Maps on your docked phone in the car or play songs while you’re in the shower. “OK Google” is one such great voice assistant (Google Assistant in Pixel devices) from Google which delivers excellent voice interface with your smartphone. Unfortunately, not all devices support “OK Google” detection while the screen if OFF due to lack of supported hardware. Luckily, you can now force “OK Google” detection on any device while the screen is OFF.

Folks over at XDA developers have come up with this beautiful theory on how to make “OK Google” available all the time. Well, the theory actually works in real time and we’ve tried it on our devices. Before we force “OK Google” detection on your device, let’s just see how it works.

How “OK Google” Works?

You need a special hardware on your device to make “OK Google” work all the time. If you do not have such hardware, there are only two options for this to work – either your device should be plugged into a power source, or the screen should be ON. Well, both the options are pretty useless as plugging your device into a power source all the time beats the purpose of the mobile device. Moreover, you don’t want to leave your screen ON all the time resulting in battery drain. But if you can make your device think it’s either charging, you can force “OK Google” to work even when the screen is OFF.

Here comes the Android debug commands into the show. There is a debug command called “dumpsys battery” which can be used to make your device think it’s charging even though it’s not. You can do this by giving a shell command “dumpsys battery set ac 1” but there are drawbacks with this method. Firstly, the battery icon in the status bar will be frozen, and the data will not be refreshed for other apps. You can easily overcome this with another command “dumpsys battery reset” when the screen is ON. The other drawback is an increase in battery drain even though it’s not much. On my OnePlus 3, it’s just a few minutes difference in battery life which is not much for me.

How to Force “OK Google” detection on All devices

Well, so you need to run two commands to get this working, but it would be stupid to enter them manually every time you turn ON/OFF your device. So, we’ll use an automation app like Tasker to get this working. Also, you’ll need root on your device for these commands to work. So, make sure to root your device before following the below steps.

  1. Install the Tasker app from the Google Play Store link below. You can also use any other automation app for Android.
    Tasker Price: $2.99
  2. Open Tasker app, click on “Plus (+)” button at the bottom. Then, click on Event » Display » Display OFF and then hit back.
    create profile tasker
  3. Now, it’ll ask for creating a new task. Click on New Task » Code » Run Shell. Enter the command “dumpsys battery set ac 1” and tick the checkbox next to “Use root.”
    force ok google tasker profile
  4. Similarly, you need to create a profile for Display ON. Click on Event » Display » Display ON and then hit back. Click on New Task » Code » Run Shell. Enter the command “dumpsys battery reset” and tick the checkbox next to “Use root.”
    disable ok google
  5. Finally, you’ll see something like the below screenshot with two profiles.
    enable tasker
  6. Enable Tasker from its menu. That’s it you’re done.
    enable tasker
  7. Turn off your screen and say “OK Google” and the voice assistant should pop up. If it didn’t, make sure “From any screen” and “Trusted voice” are enabled in “OK Google” settings.

That’s it, folks. You can now open up maps or play music on any device even with the screen is OFF.


  1. This works half on my Mi Note 3 on MIUI EU ROM (I believe all other Xiaomi phones with registered fingerprint will behave the same). The screen is turned on but I still need to give my fingerprint to unlock it, even after ensuring things in step 7. Worse, my phone cannot be really locked, it keeps trying to unlock itself then locked again. Something must be missing…

  2. ZTE Axon 7 (Resurrection remix 7.1) doesn’t work either.

    When I turn off my screen or when it turn it off itself after a while, the display switch it on itself in a second. So now I can’t turn my screen off with those profiles :’D

  3. This doesn’t work for me. It seems that the current version of the Google app doesn’t listen for “Ok Google” with the screen off even if power is connected, so spoofing the power state doesn’t help.

    Any ideas?

  4. I have the same problem he has. My screen turns on when it gets connected to the charger. Any idea how to bypass that?

  5. You should probably put the note “you need ROOT” as the very first step or even a big bold disclaimer before the article. I wasted my time reading half the article only to find out that you need root for this to work…

  6. Hi, I’ve a problem…, I have a Samsung galaxy a5 2017, when the screen off, the battery is set to ON and this reactive the screen… so I can’t use it

This site uses Akismet to reduce spam. Learn how your comment data is processed.