Macro for screensaver on Android TV won't work

Mike8040

New member
Hi there,

Since a week or more I'm trying to get a macro working that starts the screensaver after 2 minutes when being on the launchers home screen. Sounds easy but in reality it's a miracle.
MD is running on one of this China Android TV boxes with Android 8.1. I'm using the ATV launcher. The system build in screensaver function doesnt work for some reason that's why I hoped MD can help.
This is what I setup. You can see I tried several constraint combination.

IMG_20210313_133758698.jpg

What I want:

# starts screensaver after 2 minutes when being on the launchers home screen
# not start screensaver when following apps are running in foreground: YouTube, Kodi, Netflix and so on

Momentary behavior:
# being in the home screen once and launching those mentioned apps after that, triggers the screensaver even when a movie or video is running. After 1 or 2 times hitting the back button when the screen saver is active I can then watch the movie without interruption

My guess is that the OS delays or fails to give the foreground/background state to MD.
MD is running in SuperUser mode.

Maybe one of you have some ideas what I can try.
 

Dm114

Well-known member
Hi there,

Since a week or more I'm trying to get a macro working that starts the screensaver after 2 minutes when being on the launchers home screen. Sounds easy but in reality it's a miracle.
MD is running on one of this China Android TV boxes with Android 8.1. I'm using the ATV launcher. The system build in screensaver function doesnt work for some reason that's why I hoped MD can help.
This is what I setup. You can see I tried several constraint combination.

View attachment 147

What I want:

# starts screensaver after 2 minutes when being on the launchers home screen
# not start screensaver when following apps are running in foreground: YouTube, Kodi, Netflix and so on

Momentary behavior:
# being in the home screen once and launching those mentioned apps after that, triggers the screensaver even when a movie or video is running. After 1 or 2 times hitting the back button when the screen saver is active I can then watch the movie without interruption

My guess is that the OS delays or fails to give the foreground/background state to MD.
MD is running in SuperUser mode.

Maybe one of you have some ideas what I can try.
1⁰) The 'Wait untill trigger' action should stop macro untill next 'ATV launcher' app runs in foreground because the trigger already fired. Triggers only fire once at very moment the event occurs.
2⁰) As constraints you could put which apps are not to be in foreground (YouTube, Netflix...)
 

Mike8040

New member
1⁰) The 'Wait untill trigger' action should stop macro untill next 'ATV launcher' app runs in foreground because the trigger already fired. Triggers only fire once at very moment the event occurs.
2⁰) As constraints you could put which apps are not to be in foreground (YouTube, Netflix...)
1) this is disabled. I think one can see it in the picture. Was just a try.
2) Already present as you can see in the macro
 

Dm114

Well-known member
1) this is disabled. I think one can see it in the picture. Was just a try.
2) Already present as you can see in the macro
Sorry, I didn't notice the difference in colour on my device.

As the macro is very simple, for test purpose I would disable all the constraints, add a trigger for the apps to be run in foreground ant then display a pop-up message to know which trigger and when it fires.
 

Mike8040

New member
the macro is very simple, for test purpose I would disable all the constraints, add a trigger for the apps to be run in foreground ant then display a pop-up message to know which trigger and when it fires.
Hey. So I wanted to create a macro that pushes messages for the foreground state but there is no trigger function for foreground/background like in the category constraint.
What was your idea? Maybe I'm missing something here
 

FrameXX

Well-known member
Hi there,

Since a week or more I'm trying to get a macro working that starts the screensaver after 2 minutes when being on the launchers home screen. Sounds easy but in reality it's a miracle.
MD is running on one of this China Android TV boxes with Android 8.1. I'm using the ATV launcher. The system build in screensaver function doesnt work for some reason that's why I hoped MD can help.
This is what I setup. You can see I tried several constraint combination.

View attachment 147

What I want:

# starts screensaver after 2 minutes when being on the launchers home screen
# not start screensaver when following apps are running in foreground: YouTube, Kodi, Netflix and so on

Momentary behavior:
# being in the home screen once and launching those mentioned apps after that, triggers the screensaver even when a movie or video is running. After 1 or 2 times hitting the back button when the screen saver is active I can then watch the movie without interruption

My guess is that the OS delays or fails to give the foreground/background state to MD.
MD is running in SuperUser mode.

Maybe one of you have some ideas what I can try.

Weird. I use MacroDroid on Mi Box S with android 9 and it's working there.
 

Dm114

Well-known member
Hey. So I wanted to create a macro that pushes messages for the foreground state but there is no trigger function for foreground/background like in the category constraint.
What was your idea? Maybe I'm missing something here
You are right. There are no triggers for fg/bg app state. In fact, as soon as an app goes background, it is considered to be closed and the appropriate trigger fires (if any) and when it comes to foreground again, it is considered to be launched again.
Even though you should be able to do what you plan with your macro. It's weird!
Was your last test (with additional triggers and messages) ok? Does everything fire on time?
 

Mike8040

New member
You are right. There are no triggers for fg/bg app state. In fact, as soon as an app goes background, it is considered to be closed and the appropriate trigger fires (if any) and when it comes to foreground again, it is considered to be launched again.
Even though you should be able to do what you plan with your macro. It's weird!
Was your last test (with additional triggers and messages) ok? Does everything fire on time?
Well that was the reason I was asking as I seemed to misunderstanding what you suggested. Was your suggestion to put a message action into my existing macro or create a new with fg/bg trigger? That wasn't clear to me.

For now I use this macro and have to close the screensaver manually when a video or movie is playing which is annoying. My wife and guests make weird faces while this happens...
The strange thing is when the video starts, the screensaver starts 2min after that, I close it with the back button and it appears again after 2min. I close it again. After that it never appears again while the same video is playing. So something weird is going on in the background.
 

Dm114

Well-known member
Well that was the reason I was asking as I seemed to misunderstanding what you suggested. Was your suggestion to put a message action into my existing macro or create a new with fg/bg trigger? That wasn't clear to me.

For now I use this macro and have to close the screensaver manually when a video or movie is playing which is annoying. My wife and guests make weird faces while this happens...
The strange thing is when the video starts, the screensaver starts 2min after that, I close it with the back button and it appears again after 2min. I close it again. After that it never appears again while the same video is playing. So something weird is going on in the background.
I didn't notice, but you should use one of the actions below (see screenshot) instead of 'Daydream...'
 

Attachments

  • 20210316_142356.jpg
    20210316_142356.jpg
    197 KB · Views: 5

Mike8040

New member
I didn't notice, but you should use one of the actions below (see screenshot) instead of 'Daydream...'
I did that and the screensaver didn't start at all. It's an Android tv not a phone. The screen never turns off and I guess there is no trigger for it either
 

Mike8040

New member
Are there any root fixes out there or Alternatives to Macrodroid?

The thing is somewhat related to Macrodroid not working probably. What I saw. Going from launcher screen directly to kodi and playing a video, the screensaver starts nearly immediately (before the video is at 2min play time) . Closing the screensaver, it appears again immediately. This happens 3-4 times till the macro stops annoying me. So Macrodroid completely ignores the "wait 2 minutes" action and retriggers the screensaver for some reason
 

420

Active member
I don't know if this will work for you (i don't have an android tv box to test on either) but it seems to be working fine on my phone;
 

Attachments

  • Screenshot_20210421-143731.png
    Screenshot_20210421-143731.png
    124.9 KB · Views: 10

Mike8040

New member
I don't know if this will work for you (i don't have an android tv box to test on either) but it seems to be working fine on my phone;
Thanks! I'm gonna try this right now. I wonder what settings do you use for the foreground constraint? There is a window opening up asking for the constraints option "not in foreground" - "alive in background(not functional on Android 8+) - not running (not functional on Android 8+).
 

420

Active member
Thanks! I'm gonna try this right now. I wonder what settings do you use for the foreground constraint? There is a window opening up asking for the constraints option "not in foreground" - "alive in background(not functional on Android 8+) - not running (not functional on Android 8+).
ehm, i actually used one that you don't mention called "running in foreground", for me it's the first option in that window... do you not have that as an option?
 

Mike8040

New member
ehm, i actually used one that you don't mention called "running in foreground", for me it's the first option in that window... do you not have that as an option?
Hey there. After I set it up like in your example it works without issues. That's great. Thanks a lot for the help!!
It's weird that the main constraint isn't working but the action constraint works.
 
  • Like
Reactions: 420
Top