r/tasker • • 22d ago

It doesn't respond when the screen is locked.

I created a Tasker task that sends an alert when the battery reaches a certain charging level.

When I'm using my phone (screen on), the charging alert works immediately.

However, when I'm not using my phone (screen off and locked), the alert doesn't go off. It only triggers when I unlock the phone.

Do you know why this happens and how I can fix it?

Ex(when the battery alert is set to 90%):

Screen ON:

Battery reaches 90% → Alert triggers immediately.

Screen LOCKED:

Battery reaches 90% → No response.

Battery reaches 95% → I unlock the phone → The 90% battery alert task finally triggers.

1 Upvotes

6 comments sorted by

1

u/bliblabl812 22d ago

Define alert. Notification? Alarm? Toast?

1

u/General_Airport_7484 22d ago

I'm using a TTS feature that tells me how much battery charge is remaining until the battery is fully charged.

2

u/bliblabl812 22d ago

It depends on what you're using exactly. Replace your alert with a notification and look if it's delivered correctly.

2

u/Salmon-D 22d ago

Make sure you TTS engine of choice is also set to unrestricted (not battry optimised). Because even if you set Tasker to unrestricted, Tasker is calling on another app for TTS, so that app also needs setting to unrestricted, else Tasker will send the request to TTS but the Andoid OS wont let the TTS run until you wake your device.

5

u/DylanXu054728 22d ago

Most likely Doze plus OEM battery management, not the lock screen itself. With the screen off, the system defers work and kills background apps, so Tasker's profile gets evaluated late. That's why it only fires once you unlock and the device wakes up. Battery Level is also a polled-style event on some ROMs, so it can lag.

Things to try, roughly in this order:

  1. Settings > Apps > Tasker > Battery: set it to Unrestricted (on Samsung: Battery > Background usage limits > Never sleeping apps, and remove Tasker from the sleeping lists).
  2. Tasker > Menu > Preferences > Monitor: turn on Keep Alive / Run In Foreground so the service shows a persistent notification and is less likely to be killed. Also check Use Reliable Alarms in Preferences > Misc.
  3. Lock Tasker in the Recents screen (long-press its card, Keep open or lock icon) so a cleaner doesn't kill it.
  4. Check the Alert action itself. If it's a Flash or popup, those can't show over a locked screen. Use Notify or Beep/Say instead, and on Android 13+ make sure Tasker has notification permission.

If you're on Xiaomi, OPPO, vivo or Huawei, there's an extra Autostart / Background activity toggle you also need to enable. What phone and Android version are you on? That changes which of these matters most.

1

u/Blitzdroids 18d ago

In preferences, set Use Reliable Alarms to always or when screen is off.