IF statemnent in tasks - Tasker Tips & Tricks

I have dificulty understanding the "IF" logic.
I tried to turn off WiFi when the screen turns dark only if I am NOT connected to a WiFi hotspot
I know I can do it by creating two profiles and querying their state, but I thought IF should also work, turns out it does not and I'd like to know why it doesn't
So I thought I'd just trythe IF condition in the task and configure a task that tells me the value of the variable %WIFII by popping up the info, but as you can see in the attached screenshots, WiFi is turned off even allthough the variable has a content matching *CONNECTION*
my phone is a rooted Xperia Z3c running 23.5.A.1.291 stock sony firmware
Any thoughts welcome

_Agility_ said:
I have dificulty understanding the "IF" logic.
I tried to turn off WiFi when the screen turns dark only if I am NOT connected to a WiFi hotspot
I know I can do it by creating two profiles and querying their state, but I thought IF should also work, turns out it does not and I'd like to know why it doesn't
So I thought I'd just trythe IF condition in the task and configure a task that tells me the value of the variable %WIFII by popping up the info, but as you can see in the attached screenshots, WiFi is turned off even allthough the variable has a content matching *CONNECTION*
my phone is a rooted Xperia Z3c running 23.5.A.1.291 stock sony firmware
Any thoughts welcome
Click to expand...
Click to collapse
2 things:
- maybe 10s is not long enough? have you tried 20?
- on screen off, Android does not seem to always be able to create a Wi-Fi connection successfully.
I have this problem myself, trying to auto turn on Wi-Fi and connect when I get home.
You can try having this run on screen on (even while locked) to test this.
Maybe someone with better knowledge of how Android system works would have a solution for this?

Thank you for your reply
Screenshots show that the WiFi connection is established successfully, I am trying to find out why some variables can bei used in the if query and others cannot
Regarding your Problem, you could try adding a wake up command at the beginning of your task. I use display dim for this purpouse (needs the secure settings or equivalent plugin)

Related

Dopod D810 randomly turning on

My bro and I both bought the above units and have upgraded to the GPS rom. Just wondering if anyone else has noticed the unit switches on by itself. We are both experiencing this problem but also have the same programs running. The button lock feature is set on.
That's right. My Trinity is alive, too ;-)
I'm using the dopod rom about one week and I noticed that today for the first time.
There's no application running in the background. It's still alive ;-)
I do not care about this problem.
Hi,
Any software you are running?
Best regards,
Gilbert
Today programs are as follows:
cLaunch
Today Agenda
Battery Pack / Program Bar
PPCProfiles
I will try and eliminate one by one to see if it is software related.
Anyone else using one of the programs and having the unit switch on by itself. This issue bothers me as I see its going to be a drain on the battery.
Activesync may be the culprit
Many PPC WM5 devices tend to turn themselves on. It is usually an Activesync setting that periodically turns on the device and tries to connect to a non existant server. Best bet is to set up a dummy server on Activesync on the PPC, then set the sync settings to Manual, then delete the dummy server.
Sorry if you already have done this, but it certainly solved the issue for me.
Camstech said:
Many PPC WM5 devices tend to turn themselves on. It is usually an Activesync setting that periodically turns on the device and tries to connect to a non existant server. Best bet is to set up a dummy server on Activesync on the PPC, then set the sync settings to Manual, then delete the dummy server.
Sorry if you already have done this, but it certainly solved the issue for me.
Click to expand...
Click to collapse
Hey Camstech, could you please give me a detailed description of how to set this up?
Thanks
My phone seems to do this too, but from what I can see, it is because of bad 3G coverage and the phone has to roam to GSM and back. Only happens at work where I got bad coverage (2/4).
AFAIK this issue is common to ALL devices and all versions.
I understand that you DO NOT TURN THE PDA OFF (Holding the on/off button), just go to "standby". So there are many Apps that tend to "awake" rather than TURN ON your PDA. It's like Sleep mode vs Hybernate in Windows. Agenda or scheduled items may turn your PDA active, even SMS messages that don't fully arrive, phone reconnecting, GPRS or UMTS changing status, profiles that are set to change over time, incoming calls, etc.
I think this is not specific to a certain ROM but to the fact that you have a full time connected and running computer in your pocket....
Hope it helps.
Looking Glass said:
AFAIK this issue is common to ALL devices and all versions.
I understand that you DO NOT TURN THE PDA OFF (Holding the on/off button), just go to "standby". So there are many Apps that tend to "awake" rather than TURN ON your PDA. It's like Sleep mode vs Hybernate in Windows. Agenda or scheduled items may turn your PDA active, even SMS messages that don't fully arrive, phone reconnecting, GPRS or UMTS changing status, profiles that are set to change over time, incoming calls, etc.
I think this is not specific to a certain ROM but to the fact that you have a full time connected and running computer in your pocket....
Hope it helps.
Click to expand...
Click to collapse
I would have to agree to a point, as I have noticed when PPCProfiles changes automatically to my car mode (bluetooth on) the pda turns on. So you are right that it's programs possibly turning it on but this never happened on my O2 mini (WM2003SE). I'm hoping a new ROM may fix this issue.
I have disabled the "auto switch template" on PPCProfiles which changes over to bluetooth at a certain time of the day and it appears to have stopped the pda turning on by itself. So far so good for 1 day. Curious if anyone else is using PPCProfiles and are experiencing this. Does anyone else use other phone profile programs with switching templates that does not turn on their pda by itself?
frigit said:
I have disabled the "auto switch template" on PPCProfiles which changes over to bluetooth at a certain time of the day and it appears to have stopped the pda turning on by itself. So far so good for 1 day. Curious if anyone else is using PPCProfiles and are experiencing this. Does anyone else use other phone profile programs with switching templates that does not turn on their pda by itself?
Click to expand...
Click to collapse
Whoops!
Where can I find PPCProfiles. I dont seem to have that kind of settings in my original HTC P3600....
Very interesting.
saminegm said:
Whoops!
Where can I find PPCProfiles. I dont seem to have that kind of settings in my original HTC P3600....
Very interesting.
Click to expand...
Click to collapse
You can find the program link below. I never had any issues when using this program on my O2 mini. It still works on my dopod d810 just that I have disabled the auto switch template.
ps the chrome template is the nicest
http://www.modaco.com/Latest_Version-t205779.html
Correction to my thinking it was PPC profiles. It is actually happening when the bletooth is turned on ( hence ppc profiles switching over to car mode - bluetooth). I disabled ppc profiles and turned on bluetooth and strangely enough the dopod kept turning on.
Is anyone else experiencing this problem when they have bluetooth on?
frigit said:
I have disabled the "auto switch template" on PPCProfiles which changes over to bluetooth at a certain time of the day and it appears to have stopped the pda turning on by itself. So far so good for 1 day. Curious if anyone else is using PPCProfiles and are experiencing this. Does anyone else use other phone profile programs with switching templates that does not turn on their pda by itself?
Click to expand...
Click to collapse
Mine sometimes turns itself on when it automatically checks my email accounts, but not always. I wonder if it isn't the 3G/Edge switch that is explained earlier. My house is in a 3G fringe area. I believe it doesn't try and wake itself up when the Wifi is on. My Prophet never did this, it would only wake up for an alarm, call, or SMS.
The main issues are reduced battery life and if you have your phone in your pocket and it wakes up, buttons can be accidentally pressed before it goes back to sleep.

Bluetooth visibility as default?

When I turn on bluetooth on my device, the option that makes it visible to other devices isn't at ON as default. As I want the device to only be visible for the first 5 minutes I want the option for the visibility for other devices should be ON as default.
Is there any way to change this?
if you find out please let me know as anything I try doesn't work!
I did try before. There is a setting in Bluetooth. Under Time out tab, change to Never. It will stay on visible. However, after certain of time or reset device, it will back to default (which is not visible) again. I havent thoroughly test it, but seems need to run some script to permenantly activate visible
Does anyone know any solution to my problem/wish yet?
When turning on the Bluetooth I want the device to set it Visible for 5 minutes as defualt.
My car headset automaticly connects to my phone when it finds it.
Now I have to go into the Bluetooth settings and manually make it visible. I want this to be default ON for the first 5 minutes when turning on Bluetooth.
Anyone know how to do this?
Thanks in advance.

[Q] Direct access to setting changes

Hi everybody,
I'm a very interested reader of all the Samsung Ativ - WP8 unlocking/rooting/registry hacking-threads and now am wondering about something:
Will it somehow be possible (or is it already?) to directly change specific phone settings (such as: Bluetooth switch, Airplane Mode switch etc.) through an app?
For an example, i would like to program a NFC-tag to turn on Airplane Mode on the phone; currently it is only possible (due to the os-restrictions) to make the NFC-tag enter the Airplane Mode-settings, but not the switch itself.. Can it maybe be done with a registry entry?
Thanks for your help, I very much appreciate it!
Keep up the awesome work!
Good question. I can look into the Settings apps themselves and see if I can find out how to flip their switch. However, it's probably not a simple registry value.
GoodDayToDie said:
Good question. I can look into the Settings apps themselves and see if I can find out how to flip their switch. However, it's probably not a simple registry value.
Click to expand...
Click to collapse
It will be interesting to see what you come up with...
My biggest pet peeve about WP (aside from the lack of a native GMail client and tiles that are unable to refresh themselves rendering battery level tiles irrelevant) is that it takes me about 20 clicks to do what should take 5... At my place of work we have restricted WiFi (only port 80 and 443, so WiFi calling is a no go), and no signal in the building.... So, when I get to work: Turn WiFi on, turn data off, turn WiFi Calling off, turn Bluetooth off. When I leave work I turn WiFi off, data on. When I get home, I turn WiFi on, data off, WiFi calling on, Bluetooth on.
It's a pain in the ass to go into individual settings menus for each of those.
There's really no point to turning Bluetooth off; the power it requires when not connected is trivial. Even WiFi draws very little when inactive.
Also, I conclude that your job sucks... but yeah, if I can get the toggle controls I will.
It drains massively when BT is in use... WiFi I'm assuming drains because of WiFi calling... I did shorten the steps... Airplane mode on, WiFi on, WiFi calling off... ?
It will drain in a few hours if I leave thing enabled. On android it was due to the IMS connection retrying constantly, and the almost zero cell connection trying to stay registered on the network. Definitely a PITA.
Yeah, Airplane Mode is better than data off if you can't even get enough signal for calls or SMS, because that will in fact drain the battery faster.
I never bothered to disable BlueTooth since the first time I enabled it, and have seen no change in the battery life. It really does appear to be inconsequential, although I suppose I didn't make a thorough study.
...any news?
All I could find is the on/off switch for the service itself, but it doesn't seem to be practical, since I think that the phone has to be restarted every time...
I'm talking about the path HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\, where you can choose the value for the "Start" key of the services, whereas the values 1 to 4 stand for:
Code:
Start REG_DWORD Start constant
Specifies the starting values for the service as follows:
START TYPE LOADER MEANING
0x0 Kernel Represents a part of the
(Boot) driver stack for the boot
(startup) volume and must
therefore be loaded by the
Boot Loader.
0x1 I/O Represents a driver to be loaded
(System) subsystem at Kernel initialization.
0x2 Service To be loaded or started
(Auto load) Control automatically for all startups,
Manager regardless of service type.
0x3 Service Available, regardless of type,
(Load on Control but will not be started until
demand) Manager the user starts it (for example,
by using the Devices icon in
Control Panel).
0x4 Service NOT TO BE STARTED UNDER ANY
(disabled) Control CONDITIONS.
Manager
Don't know if this is anything new at all, but I tested it with the Gyro Sensor (changed the Start Value from 3 to 4) and after reboot the Sensor Emitter-App didn't find it anymore; turned back to Value 3 and after reboot it worked again!
That's a cool find, but probably not super-useful to this purpose; it might let us make a "services.msc"-like app for the phone, at least to control startup and such, but actually starting and stopping the services requires something else again.
Also, another problem I was facing is the fact that every time the phone interacts with a NFC-tag there is a popup asking if the action should really be performed. This is good for some of the cases, but for the Airplane-mode automatic switch it seems a pain to confirm each time you want to switch - as the whole idea behind it was to change it automatically.
Searching for a possible solution for this problem i found this:
Google: search for "that-damn-nfc-alert-after-tapping-tag", first result
(as I am a new user I still can't post links directly)
Code:
//-------------------------WRITING
var dataWriter = new Windows.Storage.Streams.DataWriter();
dataWriter.WriteString("dummy");
//messageType is the key
publishMessageId = mDevice.PublishBinaryMessage("Windows:WriteTag.Text",
dataWriter.DetachBuffer(),
messageTransmitted);
//my MessageTransmittedHandler invokes the StopPublishingMessage(long) method
//-------------------------READING
mDevice.SubscribeForMessage("Windows.Text",
(device, message) =>
{
//do Work
});
Do you think that once we know how the Settings-App flips the switches it would be possible to create a command which doesn't require confirmation? Or would it be necessary to have an app already running in order to perform that switch automatically?
Thanks a lot!
Today I saw the registry keys at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Settings\{1DEF9B7D-2322-40eb-A007-16A75D5CDA62}\ which indicate some specific dll and app-locations for the Airplane Mode:
Code:
Values Type Size Data
String 28 Airplane Mode
Title String 82 @\windows\system32\Settings3Res.dll,-206
Type Integer 4 1
Location String 102 app://5B04B775-356B-4AA0-AAF8-6491FFEA5621/Default
Plugin String 78 {09c51652-2cbc-49d5-883e-20606f9a47bd}
I tried to reach it with Windows.System.Launcher.LaunchUriAsync(new Uri("app://5B04B775-356B-4AA0-AAF8-6491FFEA5621/Default", UriKind.Absolute)); but had no success. There is no error or anything, nothing happens.
Am I going in the wrong direction with this?
Well, at best that would only let you launch the Airplane Mode view, which is already possible in other ways (and I don't think your method works anyhow, because apps can't directly launch other apps unless they have special privileges).
Poking around in the registry is a good call, though. It may be worth looking at the permissions for that app and seeing what it can write to, although it's almost certainly going to be a special service endpoint rather than something convenient like registry value.
I see.. Couldn't the number "-206" be some kind of argument applied on the Settings3Res.dll? Since all settings (wifi, bluetooth, gps etc.) refer to that same dll but seem to have different apps (which I suppose are the pages with the switches).
No. It's an index into the stringtable. Settings3Res.dll is, as its name implies, a resource DLL; it contains no actual executable code.

Make Tasker restart GPS when fix is lost

Hey there,
I am having some problems with GPS of my phone. Sometimes I lose my GPS fix, typically when driving in an unknown area and relying on satnav.
What helps is to disable high precision location in quick settings and re-enable it.
So I thought this could be automated. If fix is lost, disable and enable GPS again.
Secure settings can do that, but I have problems getting a Tasker profile reacting properly to that state.
I tried querying the %LOCACC variable, (LOCACC < 5) but that didn't do it.
Any ideas?
Cheers, toskala
Any way to quick restart GPS?
I use Android Auto and at first signal didn't work, then I should enter the settings, turn GPS on and of on his high accuracĂ˝ mode, then all works OK
A reliable way to manipulate location mode on 6.0 (marshmallow) and up is by using the tasker AutoTools plugin.
"Good judgment comes from experience, and a lot of that comes from bad judgment." - Will Rogers
Hi everyone, does anyone can give a clue on how to track down GPS FIX =YES/NO from tasker?
I have the same q as topic starter.
Location accuracy variable is no help here as it is not reset once fix is lost but gps remains on (last known accuracy is stored)
solution found!
Tasker: read GPS FIX status (TRUE/FALSE) or #of Sats. in the fix
groups.google.com
Hi everyone,
I've read the above mentioned solution however I'm new to tasker and have therefore difficulties interpreting it.
My aim with tasker is, if gps fix is lost, to issue some task like dimm the screen of my android headunit when a tunnel is entered and restore brightness when tunnel is left.
First of all I would create a new profile with an event (gpx fix lost) and start then a task (lower brightness). outgoing task is e.g. restore brightness.
What is then the condition in the profile section of tasker and how can I use the solution above, respectively.
thanks in advance!

How to get Tasker to *actually* connect/disconnect VPN?

I have a problem with my recently purchased Tasker app. I tried posting on the official Tasker forum (https://tasker.helprace.com/s1-general/problems/top) but after I would click submit, nothing would come up. If anyone knows how to get in contact with the developers other than leaving a negative review on the Play Store that would be much appreciated.
I have a Samsung Galaxy S9 (not rooted) running whatever the latest version OS (Pie I want to say?).
I have a simple Profile setup to Connect to VPN when Wifi is connected, and Disconnect from VPN when Wifi is disconnected (as an Exit task) using the OpenVPN Tasker Plugin.
On rare occasion, everything works as expected.
Unfortunately, the majority of the time, it will indeed recognize the correct state (Wifi Connected), however, it will not connect to the VPN. When I go into Tasker, I see the Profile is green text, and if I go to More>Run Log I can see that it says something to the extent of:
"Active 2 Wifi Connected" then "Start TaskService" then "Running 3 VPN Connect" then "OK 3.1 VPN Connect.com.ffrog8.openVpnTaskerPlugin\n***\n*!" then "ExitOK 3 VPN Connect" then "Stop TaskService" (this is all in reverse order, since I think the run log puts the newest events at the top, but this is how I read them from bottom up).
Tasker even says 1 Task running on the notification bar on my lock screen. However the VPN is not connected. If I go into Tasker, turn off that profile, then turn it on again (via the toggle switch on the right hand side), the VPN will connect as expected and the run log will say the same exact thing.
Likewise for the Exit Task - when I disconnect from the network Tasker seems to recognize the state just fine (evident in Run Log and notification icon in lock screen), however my VPN remains connected (well my guess is it must disconnect for a short period as I transition from Wifi to 4g).
I have tried waiting a while to see if it's just a time issue, but I could wait hours and it will never trigger one way or the other (VPN Connect or VPN Disconnect). I have tried different Wifi networks. The Wifi State Active = "Any". In Android Settings>Apps>Tasker>Battery the toggle for "Allow background activity" is set to on, Optimize Battery Usage is set to off. Likewise for OpenVpn Tasker Plugin.
*Joao or anyone have any ideas?
Many thanks.
Troubleshooting = Because a Piece of Code went
Sorry to say that it looks like I am the 1st reply, as I have no real training in coding or programming myself.
I too recently began to play with such though with the intent to install it on some family member's devices ? However, like you I have not been able to get my desired automation regular enough to share it. When I 1st downloaded Tasker (I think) it had something about a "community" to share & get help with as well as more.
Trying to be helpful I ran a quick search for the specific site & as usual, Google had to go overboard with the results. Still hoping this will help you sooner as they all focus on that particular program:
https://community.home-assistant.io/t/tutorial-using-the-new-auth-system-with-tasker/82423
Just wondering if all the changes to Android OS as a whole may also have an affect on something minor such as whatever we choose to do with "automation" programming? Have seen throughout various post's & news that sort of thing....
for any other poor soul with the same problem, I read a couple of obscure comments on the interweb that the OpenVPN plugin for Tasker is no longer functioning, and all must be run through the Open VPN Connect app (NOT Open VPN for Android app) using intents. I found a guide once, and am testing it now and will report back if it works more reliably. Thank you Lone wolf for your reply.
just to update the poor souls, using intents like I said seems to work more reliably in terms of connecting to VPN. The only problem is if you go out of wifi range, it disconnects, but then are back within wifi range quickly (like somewhere with bad wifi signal), it will not connect again for some reason.

Categories

Resources