Doesn't always work when screen is off - Tasker Tips & Tricks

I would like to turn on the torch (aka light) when I shake my phone. If the screen is on this works perfectly
Code:
Profile: Main (3)
Restore: no
Event: Shake [ Axis:Left-Right Sensitivity:Medium Duration:Medium ]
Enter: Chopchop (4)
A1: Torch [ Set:Toggle ]
But if the screen is off (i.e. I press the power button) it only works some of the time. I've turned off battery optimization for Tasker. It seemed to help a bit but not each time. How do I have this Task trigger even when the screen is off? I selected "yes" in accelerometer under Display Off Monitoring and now it works on lock screen ,but still screen must be on. I have root.

Related

Forbidden bluetooth off

Hello,
I have a big zerolemmon battery so i don't care about using it with bluetooth alway on
I don't know why sometime (randomly) my phone turn off BT, so for the moment i set bluetooth on when my launcher is open ...
Anyone has a better idea to keep bluetooth alway on ? (with or without tasker)
I am root
Thanks for your help.
Use Tasker to add a periodic check on BT status, and if off, then turn on again?
This is how I have used Tasker to perform the same result:
Code:
Profile: BT Check (43)
Restore: no
State: BT Status [ Status: Off ]
Enter: Enable BT (86)
A1: Wait [ MS:0 Seconds:30 Minutes:0 Hours:0 Days:0 ]
A2: Bluetooth [ Set: On ]
In order to set the RESTORE to NO, once you have set your profile and your task, long click on the profile and select settings from the top bar. Can also see attached profile xml.
The wait action is also important, as it will prevent Android from disabling the BT instantenously. It might be because Android has a cool-off period once BT status is changed in order to ebable/disable the service.
Thanks mate, i add your profil on m'y phone. I'll tell you if it's fine in some days but it seems to be perfect.
Works perfect Thanks again

How to Play/Pause a Video

Hi!
..trying since days something I want to build...
What I want:
I want to use an old Tablet as a Digital VideoFrame..
..when the Tablet starts a Video should play (with GoogleVideo Player) and after 10 seconds it should Pause..
..and when motion is detected the Video should toogle to Play and after 10 Seconds Pause..and so on...
With the App "Motion Detector" I am able to start the Video...but I am not able to Pause the Video..has anyone
an idea how to do this?
thx
7.even
I'd do something like this:
Profile: Shake For Video (16)
Event: Shake [ Axis:Up-Down Sensitivity:Medium Duration:Medium ]
Enter: Anon (23)
A1: Open File [ File:xxxx.mp4 Mime Type:video/* ]
A2: Wait [ MS:0 Seconds:10 Minutes:0 Hours:0 Days:0 ]
A3: Media Control [ Cmdause Simulate Media Buttonff App: ]
The profile is triggered by an event > sensor > then choose how you want to trigger
Action 1 opens a video file
Action 2 waits 10 seconds
Action 3 Media > media control > pause
You could blend the use of Motion Detector by trigger the tasker task on the launch of Motion Detector and execute the pause command after 10 seconds.
..thanks for the answer...I did it that way but the VideoPlayer doesnt Pause or Stop or anything...
7.even said:
..thanks for the answer...I did it that way but the VideoPlayer doesnt Pause or Stop or anything...
Click to expand...
Click to collapse
Works for me, I tested before posting.

Need to ask about tasker

Hi, I want to do something with tasker and I can't how to do
I want to disable call vibration + disable pin lock security when I go out from my wifi range
And enable it when I am in range
Please help
Please help
This approach requires your device to be rooted to work around the Android limitations for secure lock screens.
Start with a profile that is triggered by the presence of your wifi network.
Create a new profile:
State -> Net -> WiFi Connected
Configure to your specific WiFi network. If you do this while actually connected to the network it will be easier.
Now create an enter task to enable vibration and secure lock screen (sets the secure lock screen to engage 1 minute after screen off = 3600 seconds).
Audio -> Vibrate Mode [
Mode:Vibrate
]
Code -> Run Shell [
Command:Settings put secure lock_screen_lock_after_timeout 3600
Timeout (Seconds):0
Use Root: on
Store Output In:
Store Errors In:%LockScreenError
Store Result In:
Continue Task After Error: on
]
Create an exit task to disable vibration and secure lock screen (sets the secure lock screen to engage 1 day after screen off = 86400 seconds).
Audio -> Vibrate Mode [
Mode: off
]
Code -> Run Shell [
Command:settings put secure lock_screen_lock_after_timeout 86400
Timeout (Seconds):30
Use Root: on
Store Output In:
Store Errors In:%UnLockScreenError
Store Result In:
Continue Task After Error: on
]
To better understand using root shells to modify secure settings see Replace Secure Settings with Shell Commands

Switch on/off based on 2 conditions?

Hi guys, I'm trying to reply something I had done with another task app (llama), but idk why, isn't working properly. Basically, I wanna airplane mode set on or off under not 1 but 2 conditions:
if time is between x and y (first condition)
and
if screen is on (second condition)
then
do nothing
but if screen is off, turn on airplane mode
this imply that when, between x and y, I will turn on the phone (for example during night, to check something), it will turn automatically plane mode off, and again on when screen turns off.
Any ideas to get this working? Thank you!
I think the most reliable way to do this is with three simple profiles.
The first is for the time context. The enter task would set a variable (e.g. %SleepTime) to "true".
The second profile has 2 contexts. The first is to check the previous variable (%SleepTime) is set to "true". The second context is screen off. The task would set a different variable (e.g. %ScreenOff) to true.
The third context checks for (%ScreenOff) is true. The enter task turns on airplane mode. The exit task turns off airplane mode.
The exit task for the first 2 profiles clears the variables.
This could be all handled in one profile using loops and tests for state. IMHO, using 3 profiles is more responsive.
hello,
i use a variable %Night, which is set to "yes" with a profile with the time condition and screen off condition ("if %SCREEN is off") without exit task.
%Night is set to "no" with other profile and all conditions you like. In your case i think it's only the time condition.
The airplane mode profile has as a condition "if %Night is true". Enter task: airplane on. Exit task: airplane off.
ktmom said:
I think the most reliable way to do this is with three simple profiles.
The first is for the time context. The enter task would set a variable (e.g. %SleepTime) to "true".
The second profile has 2 contexts. The first is to check the previous variable (%SleepTime) is set to "true". The second context is screen off. The task would set a different variable (e.g. %ScreenOff) to true.
The third context checks for (%ScreenOff) is true. The enter task turns on airplane mode. The exit task turns off airplane mode.
The exit task for the first 2 profiles clears the variables.
This could be all handled in one profile using loops and tests for state. IMHO, using 3 profiles is more responsive.
Click to expand...
Click to collapse
Hi guys, first thank you in Advance. Im trying this method, every condition seems ok but screen check, which remain black even if I test it on, and so airplane isnt set. I wonder why? Screenshot attached (notice Ive tried screen on just to check and it was still black as I guess means not working properly...)
Ty
There are things to remember.
The non-active state (black as you are saying) for screen off is always going to be the case when the screen is on.
When setting up and testing tasks that include variables, it is very easy to get into a non-defined state with the variables not setting/unsetting correctly. This subtle issue can cause all sorts of headaches because the variable isn't cleared (or set).
Here is the description of a working set of profiles. This variant sets a notification on screen off and screen on to affirm the task ran. The screen off task also vibrates as a tactile assurance the screen off task ran.
Code:
Profile: Airplane Mode Time (86)
Time: From 2:30PM Till 4:30PM
Enter: Airplane Mode Time Variable (87)
A1: Variable Set [
Name:%AirplaneModeSleepTime
To: true
Recurse Variables: Off
Do Maths: Off
Append: Off ]
Exit: Airplane Mode Time Exit (126)
A1: Variable Clear [
Name:%AirplaneModeSleepTime
Pattern Matching:eek:ff
Local Variables Only: Off ]
Profile: Airplane Mode Screen Off (88)
Priority: 1
State: Variable Value [ %AirplaneModeSleepTime ~ true ]
State: Display State [ Is: Off ]
Enter: Airplane Mode Screen Off (94)
A1: Variable Set [
Name: %AirplaneModeScreenOff
To: true
Recurse Variables: Off
Do Maths: Off
Append: Off ]
Exit: Airplane Mode Display On (11)
A1: Variable Clear [
Name:%AirplaneModeScreenOff
Pattern Matching:eek:ff
Local Variables Only: Off ]
Profile: Airplane Mode Set (118)
Priority: 1
State: Variable Value [ %AirplaneModeScreenOff ~ true ]
Enter: Airplane Mode Action (120)
A1: Notify [
Title:Airplane Mode On
Text:
Icon:
Number: 0
Permanent: Off
Priority: 3 ]
A2: Airplane Mode [ Set: On ]
A3: Vibrate Pattern [
Pattern: 0,500,100,500,100,500,100,500,100,500,100,500,100,500 ]
Exit: Airplane Mode Exit (125)
A1: Notify [
Title:Airplane Mode Off
Text:
Icon:
Number: 0
Permanent: Off
Priority: 3 ]
A2: Airplane Mode [
Set: Off ]
A3: Variable Clear [
Name:%AirplaneModeScreenOff
Pattern Matching: Off
Local Variables Only: Off ]
Hmm thx but Im confused a little, is possible to past this text somewhere?
No. But it sounds like you are really new to tasker. Maybe you should work through some tutorials to get some practice.
I used tasker long time ago, but what Im trying to do is quite simple, yet it doesnt work....for example Ive tried this simpler way:
Profile 1) Display on -> var set %Screenon to true
Profile 2) Display off -> var set %Screenon to false
Profile 3) from x to y -> 2 conditions) airplane mode set on if %Screenon is false; 2nd condition: airplane mode set off if %Screen on is true
I wanted to try like this to see but it works only when I press the play button under the actions. Otherwise if i turn on or off the screen nothing change...
takui said:
I used tasker long time ago, but what Im trying to do is quite simple, yet it doesnt work....for example Ive tried this simpler way:
Profile 1) Display on -> var set %Screenon to true
Profile 2) Display off -> var set %Screenon to false
Profile 3) from x to y -> 2 conditions) airplane mode set on if %Screenon is false; 2nd condition: airplane mode set off if %Screen on is true
I wanted to try like this to see but it works only when I press the play button under the actions. Otherwise if i turn on or off the screen nothing change...
Click to expand...
Click to collapse
I would suggest trying to turn screen on and off, check the Tasker log to see if the variable is set properly.
- If it does, trying manually set it to false, and then true in your time range x-y to see if 2nd profile reacts to that.
- If it does not, check 1st profile again, maybe you are using screen on and unlocked? or whatever... anyways, that should narrow down the possibilities at least
Ty, Reading the log Ive noticed that the variable is set correctly (see attach) but the 3rd profile doesnt set airplane...hmm
takui said:
Ty, Reading the log Ive noticed that the variable is set correctly (see attach) but the 3rd profile doesnt set airplane...hmm
Click to expand...
Click to collapse
so what does the log say when you manually run 3rd profile? just so we know the profile does not correctly start or not correctly run...
If I run it manually it works in both ways (on and off) otherwise no. Logs attacched. Its just that it doesnt check alone the variable and doesnt start alone
ok to clear things up:
- your display profiles can be combined into 1 with exit task
- have you tried to manually set %ScreenOn to each value to see if the profiles reacts to that - I doubt it would
- try using equal instead of match for the variable
- maybe post your profiles and tasks
Hello. I had them combined before, ive tried splitting but mothing changed... Log show that the variable is set correctly, what doesnt change is the airplane mode, as it doesnt care the variables at all (time frame condition btw works, as it is showed green...)
takui said:
Hello. I had them combined before, ive tried splitting but mothing changed... Log show that the variable is set correctly, what doesnt change is the airplane mode, as it doesnt care the variables at all (time frame condition btw works, as it is showed green...)
Click to expand...
Click to collapse
ok I think I know what the problem is: your timed profile is triggered by state and not event, which means during the time frame, profile is triggered and finishes, it will test your variable during this time only, and will not recheck if this variable changes, when task is finished.
I hope I made it somehow clear....
anyways, try this, put the variable in the condition part as well.
Hm ok maybe Ive understood what you mean but so, what kind of profile Ive to make? Everyone is triggered from something, state, event, app, UI...isnt "free", so Ive choosed time...
add condition variable set
Hmm Im closer to a solution, still I cant get the timeframe works. In this new adapation, airplane is set correctly on and off when I turn on and off the screem but, it doesnt consider the timeframe so, if I turn off the screen in the morning, it sets airplane mode on anyway. In attach the new setup...
Edit: if Im not wrong, the red bar on the right means that the conditions are not reached, right? So why even if the bar is red in the airplane on mode, it turns on when the display turns off? ....
here you go, try this on your device at night time. if you have a heart attack, I'm not responsible...
ktmom said:
I think the most reliable way to do this is with three simple profiles.
The first is for the time context. The enter task would set a variable (e.g. %SleepTime) to "true".
The second profile has 2 contexts. The first is to check the previous variable (%SleepTime) is set to "true". The second context is screen off. The task would set a different variable (e.g. %ScreenOff) to true.
The third context checks for (%ScreenOff) is true. The enter task turns on airplane mode. The exit task turns off airplane mode.
The exit task for the first 2 profiles clears the variables.
This could be all handled in one profile using loops and tests for state. IMHO, using 3 profiles is more responsive.
Click to expand...
Click to collapse
alienyd said:
here you go, try this on your device at night time. if you have a heart attack, I'm not responsible...
Click to expand...
Click to collapse
? This just speech... I dont need it Im confused

Increments in Tasker volume control

I'm on a Galaxy S10 Plus and have over 15 increments in all my sound controls. Tasker only has 15 increments. I've got Tasker set to lower my notification volume at work but Tasker's "1" step isn't low enough. My phone sound has the ability to go many steps lower than Tasker's "1".
How can I address this in Tasker to get the volume lower than 1 or to increase the sound increments in Tasker? Thank you!
A couple of thoughts...
If you use a variable entry set to 0, does it go lower? If you're not yet aware, tap the double arrow button to get to an input field.
Or, see if a custom settings action will give you fine grained control.
I'm not sure how to use a variable entry to adjust the sound. Can you please elaborate?
Thank you!
ktmom said:
A couple of thoughts...
If you use a variable entry set to 0, does it go lower? If you're not yet aware, tap the double arrow button to get to an input field.
Or, see if a custom settings action will give you fine grained control.
Click to expand...
Click to collapse
https://www.pocketables.com/2012/08/beginners-guide-to-tasker-part-2-variables.html
I'm sorry but I don't see how to use a variable to set sound increments. Can you help? Thank you!
ktmom said:
https://www.pocketables.com/2012/08/beginners-guide-to-tasker-part-2-variables.html
Click to expand...
Click to collapse
I don't know what more to tell you. Create a variable, set it to a value (see the link that was posted) and use that variable in the action you are using to control the notification volume (tapping the crossed arrows to get the input field as mentioned in my first reply)
Hi - I tried using a variable with settings of 0.5 and it just takes the volume down to zero. I also tried setting the media volume to the lowest setting and recording what value that was in a variable and it just came up as "1" despite a value of 1 not getting me the lowest volume level. Has anyone figured out how to do this?
I have not figured out how to do this through Tasker.
It's clanky, but what I've done for the moment is to use Tasker to set Media Volume to zero, then in a simple loop I mimic pressing the "Volume Up" hardware button as many times as requested.
Task: Adjust Volume
A1: Media Volume [
Level: 0 ]
A2: Variable Set [
Name: %max
To: 17
Max Rounding Digits: 3
Structure Output (JSON, etc): On ]
A3: Variable Set [
Name: %num
To: 1
Max Rounding Digits: 3
Structure Output (JSON, etc): On ]
<loop>
A4: If [ %num < %max | %num = %max ]
A5: Button [
Button: Volume Up ]
A6: Variable Set [
Name: %num
To: %num + 1
Do Maths: On
Max Rounding Digits: 3
Structure Output (JSON, etc): On ]
A7: Goto [
Type: Action Label
Label: loop ]
A8: End If
A9: Flash [
Text: %VOLM
Continue Task Immediately: On
Dismiss On Click: On ]
I have the final Flash in there just to check out what Tasker is calling my required volume; I'll clearly be taking it out when I put the task into implementation, if I decide it works at least well enough for me.
For the record, I have a Samsung Galaxy S10e, on which I have used Sound Assistant to increase my volume rocker steps to 30.

Categories

Resources