Activity detection when device locked

Post your questions and help other users.

Moderator: Martin

Post Reply
ariloc
Posts: 109
Joined: 05 Jun 2016 21:36

Activity detection when device locked

Post by ariloc » 24 Oct 2016 00:23

I have an app that triggers when I press both volume buttons at the same time. It shows a completely white screen and it increases the screen brightness to the highest level. I can do that even if the device is locked.

But I have a problem. I have configured Automagic to turn on screen filter at night so when I try to use that flashlight app, it can't increase the brightness level because the Screen Filter limits it. Therefore, I made a flow to detect when the white screen activity of that app have started and, in that case, Screen Filter is disbaled. Then, another flow detects when it finishes and enables the Screen Filter again.

It worked successfully when the device is unlocked. But when I try to enable the screen flashlight when my device is locked, Automagic can't detect that the activity has started. I need to enter to the notification tray so it can detect it. Then, it detects when the activity finishes perfectly.

What can I do to fix it? It's an OS problem or it is app's?

Sorry for my incomprehensible English.

User avatar
MURTUMA
Posts: 697
Joined: 05 Mar 2013 22:43

Re: Activity detection when device locked

Post by MURTUMA » 24 Oct 2016 06:33

Most of the things in AM has multiple solutions to do things. Sometines some won't work or are otherwise unfeasibe and then you might have to think out side of the box to find working solution.

Your problem: AM does not allow flashlight to brighten the screen when screen is locked.
Slution 1: Detect activity. Does not work when screen is locked.

So.. the keyword here seems to be a locked device. How could you stop the screen filter when device is locked?

Solutin 2: I could probably disable the screen filter flow during lockscreen?



Sorry for not giving a straight answer. I try to teach you how to solve things here. Ask for more if these tip didn't help you. ;)

ariloc
Posts: 109
Joined: 05 Jun 2016 21:36

Re: Activity detection when device locked

Post by ariloc » 24 Oct 2016 09:28

The second solution may work. But before I thought about detecting the activity has started, I tried to detect when the buttons are pressed at the same time, the trigger of that app.

But as far as I know, Automagic can't detect this, right? Or am I wrong?

User avatar
MURTUMA
Posts: 697
Joined: 05 Mar 2013 22:43

Re: Activity detection when device locked

Post by MURTUMA » 24 Oct 2016 09:48

Not with dedicated trigger or condition, but it is possible to catch button events from phone logs. Though, it requires root privileges and I'm not sure if it's possible when phone is locked.

ariloc
Posts: 109
Joined: 05 Jun 2016 21:36

Re: Activity detection when device locked

Post by ariloc » 24 Oct 2016 22:12

Ok. I will try to do the idea of turning of screen filter when the device is locked.

ariloc
Posts: 109
Joined: 05 Jun 2016 21:36

Re: Activity detection when device locked

Post by ariloc » 26 Oct 2016 09:32

I tried to detect when I lock the device but I can't find a trigger that fits my needs. There's no trigger when you lock or the device or when the screen gets off. Is there any trigger that can do this and I haven't noticed it yet?

User avatar
MURTUMA
Posts: 697
Joined: 05 Mar 2013 22:43

Re: Activity detection when device locked

Post by MURTUMA » 26 Oct 2016 11:53

Trigger Display state and condition Device locked. You actually don't have to test if device is locked. Display state is sufficient as the filter won't need to be active if screen is off regardless if it is locked.

ariloc
Posts: 109
Joined: 05 Jun 2016 21:36

Re: Activity detection when device locked

Post by ariloc » 28 Oct 2016 09:34

Thanks!

ariloc
Posts: 109
Joined: 05 Jun 2016 21:36

Re: Activity detection when device locked

Post by ariloc » 08 Nov 2016 10:08

Finally, I didn't need to do that because the new method to detect if an activity has started or ended, recently implemented in Automagic, the statistics usage method, could detect without problems that flashlight app when the device is locked.

Thank you for all your help.

Post Reply