Airplane Mode radios dependend on what is turned on/off - Tasker Tips & Tricks

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?

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

Tasker Noob Help

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: ] "

HELP:Task won't run when phone locked,using shell with root

Hello,
I am using tasker latest version from playstore,issue i am facing is where i have a task to perform root input command to send info via whatsapp, this task would work pretty well when screen ON & unlocked, but wouldnt run with screen locked.
I am learning tasker and have been fun tinkering with stuff, perhaps there are some basic pointers some one could point me towards?
Basic Whatsapp send task
Send WhatsApp Basic (2)
A1: Secure Settings [ Configuration:Screen & Keyboard Lights On
30 Seconds Timeout (Seconds):0 Continue Task After Errorn ]
A2: Go Home [ Page:0 ]
A3: Wait [ MS:150 Seconds:0 Minutes:0 Hours:0 Days:0 ]
A4: Launch App [ App:WhatsApp Data: Exclude From Recent Appsff Always Start New Copyn ]
A5: Wait [ MS:300 Seconds:0 Minutes:0 Hours:0 Days:0 ]
A6: Run Shell [ Command:input tap 850 150 Timeout (Seconds):0 Use Rootn Store Output In: Store Errors In: Store Result In: ]
A7: Wait [ MS:300 Seconds:0 Minutes:0 Hours:0 Days:0 ]
A8: Run Shell [ Command:input tap 850 150 Timeout (Seconds):0 Use Rootn Store Output In: Store Errors In: Store Result In: ]
A9: Wait [ MS:300 Seconds:0 Minutes:0 Hours:0 Days:0 ]
A10: Type [ Text:%Clip Repeat Times:1 ]
A11: Wait [ MS:300 Seconds:0 Minutes:0 Hours:0 Days:0 ]
A12: Run Shell [ Command:input tap 630 330 Timeout (Seconds):0 Use Rootn Store Output In: Store Errors In: Store Result In: ]
A13: Wait [ MS:300 Seconds:0 Minutes:0 Hours:0 Days:0 ]
A14: Type [ Text:%Clipmsg Repeat Times:1 ]
A15: Wait [ MS:300 Seconds:0 Minutes:0 Hours:0 Days:0 ]
A16: Run Shell [ Command:input tap 1000 1100 Timeout (Seconds):1 Use Rootn Store Output In: Store Errors In:%clip Store Result In: ]
A17: Variable Clear [ Name:%Clipmsg Pattern Matchingff Local Variables Onlyff ]
A18: Variable Clear [ Name:%Clip Pattern Matchingff Local Variables Onlyff ]
A19: Flash [ Text:Message sent!! Longff ]
A20: Button [ Button:Back ]
A21: Wait [ MS:150 Seconds:0 Minutes:0 Hours:0 Days:0 ]
A22: Button [ Button:Back ]
A23: Button [ Button:Back ]
A24: Button [ Button:Back ]
A25: Stop [ With Errorff Task: ]
Here %Clip is senders name, %Clipmsg is what you want to send,the text
I use it to send date time and GPS co ordinates via whatsapp using Task no 2
Send Location WhatsApp (55)
A1: Variable Set [ Name:%Clipmsg To:%DATE,%TIME,**Using Google Api to send link*** Recurse Variablesff Do Mathsff Appendff ]
A2: Get Location [ Source:Any Timeout (Seconds):100 Continue Task Immediatelyff Keep Trackingff ]
A3: Variable Set [ Name:%Clip To:*mobile number** Recurse Variablesff Do Mathsff Appendff ]
A4: Perform Task [ Name:Send WhatsApp Basic Priority:%priority Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable: Stopff ]
A5: Stop [ With Errorff Task:Send WhatsApp Basic ]
A6: Beep [ Frequency:500 Duration:1000 Amplitude:50 Stream:3 ]
Tasker is my device administrator,Battery saving has been turned off,Run in foreground enabled,Reliable Alarms Always
What am i missing?
Device;Redmi Note 4, Snapdragon 625 version, OS-Miui 9 (Android 7.0), Rooted.
Is it locked with the display on or off? Tasker is weird sometimes when the screen is off. You can wake the screen with Secure Settings.
Have you disabled battery optimization for tasker? Tried using reliable alarms in preferences?
"Good judgment comes from experience, and a lot of that comes from bad judgment." - Will Rogers
I am facing similiar issue Tasker not run during screen off and locked. I would like to know too.
claudchan said:
I am facing similiar issue Tasker not run during screen off and locked. I would like to know too.
Click to expand...
Click to collapse
Your response to the post above yours?
ktmom said:
Your response to the post above yours?
Click to expand...
Click to collapse
No. My Tasker is not optimized. I still facing not run. When I wake up my screen and unlock, then task start to run.
claudchan said:
No. My Tasker is not optimized. I still facing not run. When I wake up my screen and unlock, then task start to run.
Click to expand...
Click to collapse
In addition to disabling battery optimization for Tasker, you need to enable reliable alarms in preferences so when the screen is off, Tasker still runs.
If you are using a Samsung device, there are probably additional settings specific to Samsung to prevent the ROM from killing Tasker processes when the screen is off.
"find somebody that you think is undeserving of your compassion and give it to them" - Christian Picciolini
ktmom said:
In addition to disabling battery optimization for Tasker, you need to enable reliable alarms in preferences so when the screen is off, Tasker still runs.
If you are using a Samsung device, there are probably additional settings specific to Samsung to prevent the ROM from killing Tasker processes when the screen is off.
"find somebody that you think is undeserving of your compassion and give it to them" - Christian Picciolini
Click to expand...
Click to collapse
I did try realiable alarm set to always. Still have same issue. Sometimes it work but sometimes not.
claudchan said:
I did try realiable alarm set to always. Still have same issue. Sometimes it work but sometimes not.
Click to expand...
Click to collapse
What device, ROM and Tasker version are you using? Do you have a wake lock blocker installed? Maybe xposed, a Magisk module, greenify...
At this point, it would also help for you to share your profile.
Make sure it's named - not a default name assigned by tasker. Then long press on the name to highlight the profile. Go to the 3-dot menu and select export -> Description to Clipboard.
Then you'll be able to paste it. Be aware, it easier to use pastebin then link to a post here.
If you paste in a post here, the forum software will convert all semicolons with characters after, typically "on" and "off" 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
ktmom said:
What device, ROM and Tasker version are you using? Do you have a wake lock blocker installed? Maybe xposed, a Magisk module, greenify...
At this point, it would also help for you to share your profile.
Make sure it's named - not a default name assigned by tasker. Then long press on the name to highlight the profile. Go to the 3-dot menu and select export -> Description to Clipboard.
Then you'll be able to paste it. Be aware, it easier to use pastebin then link to a post here.
If you paste in a post here, the forum software will convert all semicolons with characters after, typically "on" and "off" 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
Click to expand...
Click to collapse
Device Oneplus One
Custom ROM Oreo, Bootleggers but had same issue on other rom too. Thunder kernel.
Using Magisk but no module installed.
App use ForceDoze. I had set whitelist for tasker too.
Tasker version 5.4.1b.bf2
The profile that had issue;
https://pastebin.com/qxnmy0vL
claudchan said:
Device Oneplus One
Custom ROM Oreo, Bootleggers but had same issue on other rom too. Thunder kernel.
Using Magisk but no module installed.
App use ForceDoze. I had set whitelist for tasker too.
Tasker version 5.4.1b.bf2
The profile that had issue;
https://pastebin.com/qxnmy0vL
Click to expand...
Click to collapse
You exported to XML, not description to clipboard so I'm guessing what's happening. I think you need to revisit your WiFi connected context and set "active" to "any".
If that doesn't help, please export again and use DESCRIPTION to clipboard.
"find somebody that you think is undeserving of your compassion and give it to them" - Christian Picciolini
ktmom said:
You exported to XML, not description to clipboard so I'm guessing what's happening. I think you need to revisit your WiFi connected context and set "active" to "any".
If that doesn't help, please export again and use DESCRIPTION to clipboard.
"find somebody that you think is undeserving of your compassion and give it to them" - Christian Picciolini
Click to expand...
Click to collapse
I use wifi near not wifi state. There is no input for active or any. Today tested and the issue still persist.
Pastbin: https://pastebin.com/PFxysnL6
claudchan said:
I use wifi near not wifi state. There is no input for active or any. Today tested and the issue still persist.
Pastbin: https://pastebin.com/PFxysnL6
Click to expand...
Click to collapse
Switch "toggle WiFi" to "on" (check the box) in the WiFi near context. Make sure WiFi scanning is enabled in settings. On Oreo; security&location -> location -> scanning
"find somebody that you think is undeserving of your compassion and give it to them" - Christian Picciolini
ktmom said:
Switch "toggle WiFi" to "on" (check the box) in the WiFi near context. Make sure WiFi scanning is enabled in settings. On Oreo; security&location -> location -> scanning
"find somebody that you think is undeserving of your compassion and give it to them" - Christian Picciolini
Click to expand...
Click to collapse
Toggle wifi doesn't have option to choose wether is on or off.
So I just make it checked?
Yes, check the box for toggle WiFi to turn it on.
"find somebody that you think is undeserving of your compassion and give it to them" - Christian Picciolini
ktmom said:
Yes, check the box for toggle WiFi to turn it on.
"find somebody that you think is undeserving of your compassion and give it to them" - Christian Picciolini
Click to expand...
Click to collapse
Seems like working. So is the wifi toggle require to be checked. But from my past years i been using without wifi checked but working fine. Still not sure what is the recently caused. Anyway thanks a lot man.
Problem still the same after clean flashed new rom.
I assuming Is Tasker clashed during screen off.

tasker - profile based on time - new user

Hi all,
I'm using phone profile plus on Android, and it's work very well, but it's quite limited... So I want to test Tasker
BUT I don't know why my profile didn't start automatically...
I want to have, for example very easy, one task for the day and on exit another one for one profile.
Profile: Day (16)
Restore: no Enforce: no
Time: From 07:30 Till 22:20
Enter: Journée (17)
Abort Existing Task
A1: Wait [ MS:0 Seconds:5 Minutes:0 Hours:0 Days:0 ]
A3: Bluetooth [ Setn ]
Exit: Nuit (6)
A1: Wait [ MS:0 Seconds:5 Minutes:0 Hours:0 Days:0 ]
A2: Do Not Disturb [ Mode:None Continue Task After Errorn ]
A3: [X] Auto Brightness [ Setff ]
Task: Background Image: Layoutopup Task Buttons Timeout (Seconds):10 Show Over Keyguardn ]
Ok i dont understand maybe how it is work but it didn't start on time..
I tried to change manually the time to see what happen, but even if i apply the changing, nothing happen, and sometimes it's work... But most of the time nothing!!
I have allowed all permission for Tasker, same for power save etc...
What's wrong?
Please help me!
Edit : hum I have understand why it didn't work...
But please what can I do to have profile
1) profile 7 to 22 : task A
2) profile 22 to 7 : task B
When I tried that, I have two profile activated...
Thanks
For example now... Profile not activated, why??...
In preferences, monitor tab, make sure "use reliable alarms" is set to always.
"Good judgment comes from experience, and a lot of that comes from bad judgment." - Will Rogers
ktmom said:
In preferences, monitor tab, make sure "use reliable alarms" is set to always.
"Good judgment comes from experience, and a lot of that comes from bad judgment." - Will Rogers
Click to expand...
Click to collapse
Thanks I will try !

Tasker Mute call if unknown Contact

Is there a way to use Tasker to mute calls from numbers not in my contacts?
Yes, I end the call if not in my contacts which effectively just seems them to voice mail. The end call action is not guaranteed to work on all devices, but you could exchange it for a action to lower the audio -> ringer volume.
In the following profile, I use a variable %CallBusy, to prevent disconnecting if I'm actively in a call. This variable is set in a separate profile that just looks if the phone is off hook.
Profile: Unknown Caller Disconnect
Event: Phone Ringing [ Caller:!C:ANY ]
State: Variable Value [ %CallBusy !~ true ]
Enter: End Call
A1: End Call
A2: Variable Set [
Name:%CallerEnded
To:%CNUM
Recurse Variables: Off
Do Maths: Off
Append: Off
Max Rounding Digits:0 ]
A3: Flash [
Text:Just blocked caller %CallerEnded
Long: On ]

Categories

Resources