Tasker Noob Help - Xiaomi Mi MIX Questions & Answers

i'm not to familiar with Tasker and I have never use it before and i'm trying to make two profiles, obviously a step by step would be helpful
1-" Profile: Enable Hotword Detection (180)
Event: Display Off
Enter: Anon (182)
A1: Run Shell [ Command:dumpsys battery set ac 1 Timeout (Seconds):0 Use Root : on Store Output In: Store Errors In: Store Result In: ] "
and the other one is: ->->->->->->
2-" Profile: Disable Hotword Detection (191)
Event: Display Unlocked
Enter: Anon (192)
A1: Run Shell [ Command:dumpsys battery reset Timeout (Seconds):0 Use Root : on Store Output In: Store Errors In: Store Result In: ] "

Related

[Guide] Kill all frozen apps with Tasker

Hello,
Do you had frozen some system apps and bloatwares ? Did you observed that these are not killed ?
Here is a script for Tasker, to force stop (kill) all frozen apps (greenify). It’s cleaner than just freeze. These are not uninstall, just keep frozen but stopped now.
Description :
Code:
Kill frozen apps (24)
Stay Awake
A1: Notify [ Title:start Text:%TIME Icon:null Number:0 Permanent:eek:ff Priority:3 ]
A2: Run Shell [ Command:su Timeout (Seconds):0 Use Root:eek:n Store Output In:%RET Store Errors In:%ERR Store Result In: Continue Task After Error:eek:n ]
A3: Run Shell [ Command:pm list packages -d Timeout (Seconds):0 Use Root:eek:n Store Output In:%RET Store Errors In:%ERR Store Result In: Continue Task After Error:eek:n ]
A4: Variable Split [ Name:%RET Splitter:package: Delete Base:eek:ff ]
A5: For [ Variable:%RET Items:%RET(2:130) ]
A6: Run Shell [ Command:am force-stop %RET Timeout (Seconds):0 Use Root:eek:n Store Output In:%RET Store Errors In:%ERR Store Result In: Continue Task After Error:eek:n ]
A7: End For
A8: Notify [ Title:End Text:%RET
%TIME Icon:null Number:0 Permanent:eek:ff Priority:3 ]
Steps of the script :
1- Get a list of all packages disabled.
2- Split the results into variables, one package by variable
3- In a loop, for each package, launch a shell with su to force stop package.
I didn’t identify the maximum of the list of packages, so I set 130 as maximum.
In attachement, the xml to import in Tasker. To import, open the xml with Tasker. Then, open in Tasker, tap (not hold) on tasks tab on top of Tasker and select import.
Is it possible to kill Facebook, Facebook Messenger, Instagram, and Twitter on screen off?
Will this work to stop/kill open apps (not freezed/disabled) as well? The ``Kill app´´ function in Tasker does not work very well, not even with root. I tried to kill my audiobook-player when headset disconnects, the app disappears for a moment when killed but returns again after ~10 seconds. I googled about this and apparently there is no really good way to completely kill an open app?

Gear S2 send voice text from watch to phone and run tasker tasks

Send voice commands that you speak into the Gear S2 and have them transmit to your phone to run tasker tasks!
I made a youtube video of how it works : https://www.youtube.com/watch?v=SrXLeuY4sIc
I recently switched from a Pebble Time Round to a Gear S2. Pebble was very easy to run tasker apps from the watch including voice commands. Now with the Gear S2 it's a different story with the Tizen OS - not much support for this. I've seen some requests made to joaomgcd as he's done some amazing stuff for Tasker but the Tizen watches are too expensive for him to develop on.
I was trying to find a way to send voice commands that I spoke into the Gear S2 and have them transmit to my phone to run tasker tasks. I searched high and low and see that there are may others trying to so the same thing. There is the TaskS2 that lets you press the screen on the phone to run tasker apps which is good but doesn't capture text. So I came up with a work-around to be able to speak into the watch and have it run tasker tasks on the phone using the text that I spoke into the watch
**How it works once you have everything setup:**
1) The Gear S2 with the command "text" will send text info to a contact. So to get our text we will create a dummy contact.
2) Define a wake up command on the Gear S2 such as "OK Google". With your screen ready say to the watch "OK Google"
3) When the prompt comes up, say to the watch something like "Text Samsung task to deposit cheque at bank"
What this does is it recognizes the 'Text' command as sending a SMS text message to a contact called "Samsung" (which is a dummy contact). When the confirmation then it shows you the text on the watch, say "OK"
4) It then will send your phone an outgoing text message to the contact "Samsung" with the text as "task to deposit cheque at bank". The word "text" gets dropped as it's the command and "Samsung" gets dropped as it's the dummy contact it sends the message to
5) Now the contact on your phone "Samsung" has one text message with the message "Text Samsung task to deposit cheque at bank" - Yay! we now have useable text that we spoke into our Gear S2 and through the magic of bluetooth is now on our phone and we can use as a cliboard variable in tasker!
6) Macro Droid is then triggered by the fact that an outgoing sms event occurred that you told it to monitor the specific contact "Samsung". From here an action in MacroDroid is used to call a tasker task (Macro driod can use LOCALE/Tasker plugins - I used Secure settings - tasker shortcut). The tasker task then extracts the text from the Samsung contact, copies it to clipboard, deletes the outgoing text message so it's fresh for another new message, and can then other tasker steps with the text now in the clipboard.
The hardest thing I found was trying to capture the outgoing sms event as a trigger as tasker only deals with it's own "SMS sent successful" - it doesn't capture any broadcast receiver intent or ContentObserver from the SMS application on the phone and therefore no trigger once the text has been sent out. That's where after trial and error with some apps, I stumbled upon MacroDroid. This is what closed the loop on the solution - where it monitors that text being sent out by the dummy contact and it works very well for this.
**Requirements:**
-Tasker
-AutoInput tasker plugin - to simulate screen clicks and type in info)
-Macro Droid - to capture the event of sms sent when a dummy contact is used and trigger the tasker tasks
Optional
-Secure settings tasker plugin - for 'clear password' to turn screen on if you want, also for Macro Droid to run a tasker shortcut
**Steps:**
1) Create a dummy contact. I used "Samsung" as my contact name. Give it a dummy 10 digit phone number with a valid area code. I used (416)000-0000
2) Create your tasker tasks
Task 1: using Autoinput: launch contacts, lookup contact samsung, press the sms icon, long click on the message that the Gear S2 sent, copy to clipboard, delete the message - task done - you now have the text in a variable called %CLIP. At the end of this task call the next task
Task 2: now that you have the text the %CLIP variable, you can set a new variable and copy to say %CLIP1 and search and replace and remove any text you don't need. For example: "task to deposit cheque at bank" can be massaged using variable search and replace to something like "to deposit cheque at bank". In this task you can create if, else, then statements. For example:
a) "Text Samsung task to deposit cheque at bank" - if %CLIP matches reggex keyword .*task*. then run a task such as a reminder application like DGT
b) "Text Samsung drive to work" if %CLIP = keyword "drive to work" then run a task such as launching a shortcut for google maps or waze
Task 3: if needed, you can then run some clean up tasks like to close the contact & message app so it's not open in the back ground. I use 1) Go Home 2) Run Shell input keyevent 187 3) wait 1 second 4) AutoInput Action: Close all Action
3) Create a Macro in Macro droid 1) Trigger "SMS Sent to Contact" - specify contact as "Samsung" and SMS text "Any" . 2) action Locale/ Tasker plugin - Secure Settings - Execute Shortcut - choose the tasker task that you want to then run from step 2
**Here are the 2 tasker tasks:**
**1st) to deal with the capturing text on dummy contact:**
A1: Secure Settings [ Configuration:Clear Password Timeout (Seconds):0 ]
A2: Launch App [ App:Contacts Data: Exclude From Recent Appsff Always Start New Copyff ]
A3: AutoInput Action [ Configuration:Type: Text
Value: Search
Action : Click
Is Tasker Action: false
Check Screen State: false Timeout (Seconds):20 ]
A4: AutoInput Action [ Configuration:Type: Text
Value: Search
Text to Write : samsung
Action : Write
Is Tasker Action: false
Check Screen State: false Timeout (Seconds):20 ]
A5: AutoInput Action [ Configuration:Type: Id
Value: com.android.contacts:id/cliv_name_textview
Action : Click
Is Tasker Action: false
Check Screen State: false Timeout (Seconds):20 ]
A6: Wait [ MS:0 Seconds:2 Minutes:0 Hours:0 Days:0 ]
A7: AutoInput Action [ Configuration:Type: Text
Value: Send message
Action : Click
Is Tasker Action: false
Check Screen State: false Timeout (Seconds):20 ]
A8: Wait [ MS:0 Seconds:2 Minutes:0 Hours:0 Days:0 ]
A9: AutoInput Action [ Configuration:Type: Point
Value: 1292,582
Action : Long Click
Is Tasker Action: true
Check Screen State: false Timeout (Seconds):20 ]
A10: AutoInput Action [ Configuration:Type: Text
Value: Copy text
Action : Click
Is Tasker Action: false
Check Screen State: false Timeout (Seconds):20 ]
A11: AutoInput Action [ Configuration:Type: Text
Value: More
Action : Click
Is Tasker Action: false
Check Screen State: false Timeout (Seconds):20 ]
A12: AutoInput Action [ Configuration:Type: Text
Value: Delete
Action : Click
Is Tasker Action: false
Check Screen State: false Timeout (Seconds):20 ]
A13: AutoInput Action [ Configuration:Type: Text
Value: All
Action : Click
Is Tasker Action: false
Check Screen State: false Timeout (Seconds):20 ]
A14: AutoInput Action [ Configuration:Type: Text
Value: Delete
Action : Click
Is Tasker Action: false
Check Screen State: false Timeout (Seconds):20 ]
A15: AutoInput Action [ Configuration:Type: Text
Value: Delete
Action : Click
Is Tasker Action: false
Check Screen State: false Timeout (Seconds):20 ]
A16: Variable Set [ Name:%CLIP1 To:%CLIP Recurse Variablesff Do Mathsff Appendff ]
A17: Perform Task [ Name:GR If Cond Priority:%priority Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable: Stopff ]
**2nd) task to run IF statements based on keyword**
A1: Flash [ Text:%CLIP Longff ]
A2: If [ %CLIP ~R .*tomorrow.*Task.*|.*Task.*tomorrow.* ]
A3: Perform Task [ Name:TV GTD remindr tomor Priority:%priority Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable: Stopff ]
A4: Else If [ %CLIP ~R .*Task.* ]
A5: Perform Task [ Name:TV GTD remindr Priority:%priority Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable: Stopff ]
A6: Else If [ %CLIP eq Drive to work ]
A7: Perform Task [ Name:Wazewk Priority:%priority Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable: Stopff ]
A8: Else If [ %CLIP eq Drive to home ]
A9: Perform Task [ Name:Wazehm Priority:%priority Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable: Stopff ]
A10: Else If [ %CLIP ~R .*Text.* ]
A11: Perform Task [ Name:TV Type Priority:%priority Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable: Stopff ]
A12: End If

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

Just can't get some simple tasks to work

Ok. I've re-installed Tasker after a year or so and set up a few simple profiles, but I can't get a couple of very simple tasks to work.
1. Keep screen on for specific apps:
Profile > Launch App > iPlayer, Youtube or Ghostery Browser
Task > Display Timeout > 23 Hrs
Exit Task > Display Timeout > 30 secs.
Launch the apps, but screen off after 30 secs. (I've tried deleting the Exit Task, makes no difference).
2. GPS on
Profile > Launch App > Maps
Task > Location > GPS > On
Exit Task > Location > GPS > Off
GPS stays off.
Other tasks seem ok (Auto rotate for certain apps, Silent at night, etc).
I've got an LG G3 (D855), running 5.0 and rooted. I've given Tasker admin privileges and installed Autotools.
Any ideas?
Better if you post the DESCRIPTION of the profile instead of describing it.
Long press on the profile name -> 3-dot menu -> export -> export "DESCRIPTION" to clipboard (not XML). Then paste here.
Beginner mode must be off and the profile must be named. If you didn't name it, there will be a default name created from the first context. You need to actually name the profile by long pressing and tapping the "A" at the top.
"Good judgment comes from experience, and a lot of that comes from bad judgment." - Will Rogers
Thanks ktmom,
Ok here it is:
Profile: Screen On (20)
Application: BBC iPlayer or Ghostery
Enter: Screen On (21)
A1: Display Timeout [ Secs:0 Mins:0 Hours:23 ]
You edited the context and added "or Ghostery", right? If, not, how did you create the OR between two apps?
Add a flash alert action at the *end* of the Screen On task. Set the text to "Screen on %DTOUT". The flash alert should return "Screen on 82800" for a 23 hour timeout.
What device, ROM?
"Good judgment comes from experience, and a lot of that comes from bad judgment." - Will Rogers
Thanks ktmom,
No, that's just from export. Just did it again to check, it says 'Application: BBC iPlayer or Ghostery'
I'll try that. Not sure how to add a flash alert action. Is it a Variable?
From my OP: "I've got an LG G3 (D855), running 5.0 and rooted. I've given Tasker admin privileges and installed Autotools. "
Thanks for your help.
Munky99 said:
Thanks ktmom,
No, that's just from export. Just did it again to check, it says 'Application: BBC iPlayer or Ghostery'
I'll try that. Not sure how to add a flash alert action. Is it a Variable?
From my OP: "I've got an LG G3 (D855), running 5.0 and rooted. I've given Tasker admin privileges and installed Autotools. "
Thanks for your help.
Click to expand...
Click to collapse
A flash action is contained under the alerts. Your can filter in the action list, just type in "flash".
Sorry, I overlooked the device in the OP. I think the LG phones have a problem setting the display time out. Try setting it to a standard number your device recognizes, such as 10 or 15 minutes.
If that works, but not the 23 hours your trying, then there may be a way to get around the problem using a script (requires root).
Edit:
Here is an example of using code -> Run Shell with root to shame the display timeout at a system level. This may or may not work on your OS.
Profile: Screen On
Application: <whatever app(s) should trigger profile>
Enter: Screen On
A1: Run Shell [
Command:settings get system screen_off_timeout
Timeout (Seconds): 0
Use Root: On
Store Output In:%DisplayTimeOut
Store Errors In:
Store Result In:
]
A2: Run Shell [
Command:settings put system screen_off_timeout 6000000
Timeout (Seconds): 0
Use Root: On
Store Output In:%DisplayTimeOut2
Store Errors In:
Store Result In:
]
A3: Flash [
Text:Screen on %DTOUT
DisplayTimeOut %DisplayTimeOut
Long: On
]
Exit: Screen Off
A1: Run Shell [
Command:settings put system screen_off_timeout %DisplayTimeOut
Timeout (Seconds): 0
Use Root: On
Store Output In:%DisplayTimeOut2
Store Errors In:
Store Result In:
]
A2: Flash [
Text:Screen on %DTOUT
DisplayTimeOut %DisplayTimeOut
Long: On
]
"Good judgment comes from experience, and a lot of that comes from bad judgment." - Will Rogers

Airplane Mode radios dependend on what is turned on/off

Hello dear community,
I've been trying to get Tasker to put my phone into airplane mode, but dependend on what type of connections are active, it should keep certain radios on or turn them off dynamically. So, for example if I am connected to Wifi, it should keep Wifi on but turn the rest off. If I now turn Bluetooth on as well, it should change the airplane mode radios to keep Bluetooth and Wifi on. Same for cell/Service. Is that somehow realisable? Maybe with ifs and elses? I am open for ideas
Yes, you just need to define the logic flow. The action to use is probably Airplane Radios.
You could easily have a single task, with multiple instances of the Airplane Radios action, each with an if statement(s) that defines what condition should be met before it runs. For example, "if *%WIFI ~ off AND %BLUE !~ off" then the Airplane Radios action with turning off the wifi radio and leaving the BT radio on would be run.
"find somebody that you think is undeserving of your compassion and give it to them" - Christian Picciolini
Hey, it's me again. First thank you very much for the response. I managed to make the profile work with WiFi and cell service, but Bluetooth still shuts down even though by the if statement it shouldn't. What I did was I put as condition airplane mode on and as tasks: if Wifi on then airplane mode radios Bluetooth on cell on nfc on Wifi off wimax on. Same for cell but with Wifi on and cell off. For Bluetooth i did the same with Bluetooth off and the rest on. Where did I made the mistake? Or is Bluetooth a Problem on Nougat? Thanks in advance and greetings.
Please post your profile. Make sure it's named - not a default name assigned by tasker. To name the profile if it isn't already, long press on the name to highlight the profile and, at the top, tap the square with the A.
Then long press on the name to highlight the profile. Go to the 3-dot menu and select export -> Description to Clipboard.
Now you'll be able to paste it. Be aware, it easier to use pastebin and link to a post here. If you paste in a post here, the forum software will convert all semicolons with characters directly after to emoticons making it very hard to read.
"find somebody that you think is undeserving of your compassion and give it to them" - Christian Picciolini
Profile: Flugmodus (40)
State: Airplane Mode
Enter: Radios (41)
A1: If [ %BTStatus ~ 1 ]
A2: Secure Settings [ Configuration:Airplane Mode Radios: Cell, NFC, WiFi, WiMax Timeout (Seconds):0 ]
A3: End If
A4: If [ %WiFiStatus ~ 1 ]
A5: Secure Settings [ Configuration:Airplane Mode Radios: Cell, Bluetooth, NFC, WiMax Timeout (Seconds):0 ]
A6: End If
A7: If [ %CELLSRV ~ noservice | %CELLSIG ~ 0 ]
A8: Secure Settings [ Configuration:Airplane Mode Radios: Bluetooth, NFC, WiFi, WiMax Timeout (Seconds):0 ]
A9: End If
A10: If [ %BTStatus ~ 1 & %WiFiStatus ~ 1 ]
A11: Secure Settings [ Configuration:Airplane Mode Radios: Cell, NFC, WiMax Timeout (Seconds):0 ]
A12: End If
Exit: Flugmodus aus (64)
A1: Secure Settings [ Configuration:Airplane Mode Disabled Timeout (Seconds):0 ]
BTStatus and WiFiStatus are set to 1 when BT and WiFi are connected and are set to 0 if not connected.
Edit: I changed the condition to display off, still no change. WiFi and cell work while BT doesn't and shuts down although I have my BT headphones connected and BTStatus is on 1.
A7 turns off the BT radio whether it's connected or not. Maybe you should add a "AND %BTStatus !~ 1" condition.
"find somebody that you think is undeserving of your compassion and give it to them" - Christian Picciolini
That did the trick. You really helped me out there. I literally thought I must be stupid, but I just couldn't figure out where the profile went wrong. Thank you and I appreciate your time and effort.
And it's me (again...). So, the profile worked fine until I had to reboot my phone. I didn't change anything on that task, I just updated Tasker. And now the profile shuts Bluetooth down again. Any ideas on that or is it buggy?
Whenever a profile is not functioning as expected, you need to post the full profile description (as before). You should also grab a Tasker log covering the activation and execution of the profile.
"find somebody that you think is undeserving of your compassion and give it to them" - Christian Picciolini
Profile: Flugmodus Status (28)
State: Airplane Mode
Enter: Radios (40)
A1: If [ %BTStatus ~ 1 ]
A2: Secure Settings [ Configuration:Airplane Mode Radios: Cell, NFC, WiFi, WiMax Timeout (Seconds):0 ]
A3: End If
A4: If [ %WiFiStatus ~ 1 ]
A5: Secure Settings [ Configuration:Airplane Mode Radios: Cell, Bluetooth, NFC, WiMax Timeout (Seconds):0 ]
A6: End If
A7: If [ %CELLSRV ~ noservice & %BTStatus !~ 1 ]
A8: Secure Settings [ Configuration:Airplane Mode Radios: Bluetooth, NFC, WiFi, WiMax Timeout (Seconds):0 ]
A9: End If
A10: If [ %BTStatus ~ 1 & %WiFiStatus ~ 1 ]
A11: Secure Settings [ Configuration:Airplane Mode Radios: Cell, NFC, WiMax Timeout (Seconds):0 ]
A12: End If
Exit: Flugmodus aus (64)
A1: Run Shell [ Command:settings put global airplane_mode_on 0 ; am broadcast -a android.intent.action.AIRPLANE_MODE --ez state false Timeout (Seconds):0 Use Rootn Store Output In: Store Errors In: Store Result In: ]
A2: Run Shell [ Command:settings put global airplane_mode_radios "cell,bluetooth,nfc,wimax,wifi" Timeout (Seconds):0 Use Rootn Store Output In: Store Errors In: Store Result In: ]
This is the profile. And the log is in the Attachment.
I don't know what OS version you are using, but the intangible objects secure settings plug-in is obsolete starting at marshmallow. What are you trying to use from it?
Also make sure Tasker is whitelisted in greenify.
You've posted the task, but what triggers the task; something from secure settings? That top level profile (that includes the triggering context) is what is helpful to post. It includes the task as well.
"find somebody that you think is undeserving of your compassion and give it to them" - Christian Picciolini
Profile: Flugmodus Status (28)
State: Display State [ Isff ]
Enter: Radios (40)
A1: If [ %BTStatus ~ 1 ]
A2: Custom Setting [ Type:Global Name:airplane_mode_radios Value:cell,nfc,wimax,wifi Use Rootn Read Setting To: ]
A3: End If
Exit: Flugmodus aus (64)
A1: Run Shell [ Command:settings put global airplane_mode_on 0 ; am broadcast -a android.intent.action.AIRPLANE_MODE --ez state false Timeout (Seconds):0 Use Rootn Store Output In: Store Errors In: Store Result In: ]
A2: Run Shell [ Command:settings put global airplane_mode_radios "cell,bluetooth,nfc,wimax,wifi" Timeout (Seconds):0 Use Rootn Store Output In: Store Errors In: Store Result In: ]
So, this was a test run to see if it was a BT problem, a secure settings problem or a problem in the logic flow. I am on Nougat and as you said, secure settings is obsolete. So I changed that up to custom settings and ticked use Root to ensure proper execution (also used ADB to give Tasker WRITE_SECURE_SETTINGS permission). I also later tried with the integrated Tasker option for the airplanemode radios. It still turns off Bluetooth when entering airplane mode, although I explicitly told Tasker not to do so if connected. This is the log of the test where I turned all profiles off but not the airplanemode radio one and the BT Status one.
In your log, it looks like you have battling profiles. Energiesparmodus seems to be taking action on airplane mode as well as Flugmodus.
To effectively troubleshoot this, you really should disable all profiles except the one you are focused on.
Additionally, it looks like Energiesparmodus is setting power saving on Tasker on screen of and is running prior to Flugmodus.
"find somebody that you think is undeserving of your compassion and give it to them" - Christian Picciolini
Ok, before I test the rest: I have to turn the airplane mode on first then turn on energy saving mode? In the same profile?

Categories

Resources