Constraint "Screen Off" with Incoming Call Trigger

AKP

Member
How to achieve the above? I want to perform certain actions when the phone rings while it is not being used. So, for this, I used the setup as per the subject.
But the actions were not being performed. When I checked the log, I saw that it's due to "constraint failed: Screen Off."
I think what's happening is that as soon as the phone rings, the screen turns on, so this constraint is failing.
So, now how to distinguish an incoming call when the phone's screen is off vs. when the screen is on?
 

Qarboz

Well-known member
How to achieve the above? I want to perform certain actions when the phone rings while it is not being used. So, for this, I used the setup as per the subject.
But the actions were not being performed. When I checked the log, I saw that it's due to "constraint failed: Screen Off."
I think what's happening is that as soon as the phone rings, the screen turns on, so this constraint is failing.
So, now how to distinguish an incoming call when the phone's screen is off vs. when the screen is on?
You can create a second macro that sets a global variable to true when the screen is on, and sets it to false when the screen is off, with the constraint of no incoming or ongoing calls, and use the global variable as the constraint in the first macro.
 

AKP

Member
You can create a second macro that sets a global variable to true when the screen is on, and sets it to false when the screen is off, with the constraint of no incoming or ongoing calls, and use the global variable as the constraint in the first macro.
That's a neat trick. I have incorporated it in the same macro as local variables and I hope it will work. Thanks!
 

Qarboz

Well-known member
That's a neat trick. I have incorporated it in the same macro as local variables and I hope it will work. Thanks!
You can only do one macro. I recommended that you create a second macro to simplify the handling of constraints
 

AKP

Member
You can only do one macro. I recommended that you create a second macro to simplify the handling of constraints
Ok, Let me check with this. I always prefer local variables. That looks more organized to me :) Though, I must say global variables are far more functional in these cases and when you have to use them across macros.
 
Top