Detect whether App is active/paused

General discussions about Automagic and automation in general

Moderator: Martin

Post Reply
MartiSL
Posts: 3
Joined: 06 Feb 2020 13:32

Detect whether App is active/paused

Post by MartiSL » 10 Feb 2020 08:24

Hi,
not yet an automagic user but in search of a solution for a problem.
I've an app to control a remote media player (two options available, html5 running in Chrome as well as android app)
Think of it as a media player only that music is not actually played in the device. Music is stored and played in a different device, but you have cover art, volume control, pause/play, progress bar, etc
So far screensaver will trigger after a time without user interaction. Problem is I want to trigger screensaver when music is paused, not when music is playing (since I want to see song title and cover on the screen). Since I'll have a playlist, there will be no user interaction with the app. That means I need to detect activity based on changes in progress bar, counter for time played/remaining, etc

Is it possible to achieve this with automagic?
Thanks in advance :)

Micky Micky
Posts: 69
Joined: 16 Oct 2019 17:38

Re: Detect whether App is active/paused

Post by Micky Micky » 10 Feb 2020 19:08

Hello and welcome.

The answer is POSSIBLY with this trigger:

https://automagic4android.com/trigger_m ... ed_en.html

My advice to you would be to download the trial version of Automagic and test it. It's not available from Google Play Store. Here's the link:

https://automagic4android.com/evaluation_en.html

Hope this helps and maybe other forum members can help too.

Good luck
Crude but it works.

User avatar
Desmanto
Posts: 2395
Joined: 21 Jul 2017 17:50

Re: Detect whether App is active/paused

Post by Desmanto » 11 Feb 2020 19:07

When you mean no interaction >> screensaver, this mean the phone is actually locked at that time right? If yes, then use the Media session changed as pointed by Micky above. Then use action Lock device and turn on screen again. This should trigger the screensaver. But you have to try it out first, since it might not work in all devices.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200117 Official, Android Pie 9.0, Rooted.

MartiSL
Posts: 3
Joined: 06 Feb 2020 13:32

Re: Detect whether App is active/paused

Post by MartiSL » 12 Feb 2020 13:12

Micky Micky wrote:
10 Feb 2020 19:08
Hello and welcome.

The answer is POSSIBLY with this trigger:

https://automagic4android.com/trigger_m ... ed_en.html
I'll test but think most probably won't work since the media is not played in the device.
Thanks!

MartiSL
Posts: 3
Joined: 06 Feb 2020 13:32

Re: Detect whether App is active/paused

Post by MartiSL » 12 Feb 2020 13:16

Desmanto wrote:
11 Feb 2020 19:07
When you mean no interaction >> screensaver, this mean the phone is actually locked at that time right? If yes, then use the Media session changed as pointed by Micky above. Then use action Lock device and turn on screen again. This should trigger the screensaver. But you have to try it out first, since it might not work in all devices.
Hi Desmanto,
nope, the tablet isn't locked and the goal is that it never locks.

User avatar
Desmanto
Posts: 2395
Joined: 21 Jul 2017 17:50

Re: Detect whether App is active/paused

Post by Desmanto » 12 Feb 2020 19:13

MartiSL wrote:
12 Feb 2020 13:16
Hi Desmanto,
nope, the tablet isn't locked and the goal is that it never locks.
We need Screenshot to see the case better. If the screen is not locked, then it is not screen saver. It is just like another view of the app. It seems what you need is the setting of the app itself to show the info much faster. I don't know how long the "screensaver" will trigger, but it seems this is related to the app setting. Don't know if other app can interfere with it.

Since everything is always screen on, I think trigger UI Event or action Control UI can do it in the sense if there is a button that can be used to trigger the screen saver immediately. Accessibility services for Automagic should be enabled first to do this.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200117 Official, Android Pie 9.0, Rooted.

Post Reply