Guys anyway to switch between location modes in Tasker.
I'm rooted and GPS on/off doesn't seem to work.
That would be because gps on/off no longer exists. You need to switch locating mode to high accuracy or device only from battery saving.
IMHO, it's easiest to do this using AutoTools' secure setting. This task on the AutoTools forum would get you started.
It can also be done by modifying the secure setting entry using a tasker shell command such as:
This command disables:
settings put secure location_providers_allowed ' '
This command enables:
settings put secure location_providers_allowed gps,wifi,network
You should read through Not Enough Tech's shell commands post to get an idea what's happening with this type of command.
Related
Hi all,
I am thinking of a script command that can enable/disable WIFI.
What I want to achieve is when I swipe up in my Go Launcher's main screen, it will simply toggle WIFI.
I've searched through the Internet and I can only get this command.
am start -a android.intent.action.MAIN -n com.android.settings/.wifi.WifiSettings
this will only call up the page within "Wireless and Network". Not exactly what I expect.
Anyone know is such a command for toggling WIFI exists?
It should be a piece of cake for all developers but for me...... it's like a mountain......
Hi,
I noticed it's possible to grant special permissions using ADB to unlock AutoTools Secure Settings (see here).
I saw a demonstration of auto GPS on/off without root and without the "automatic click path" (as we see in Greenify and AutoInput actions), is it possible to have the same behaviour for airplane mode? A simple toast notification instead of the complex path, which needs screen on and unlocked phone.
I hope I've explained well what I want to say.
Look at http://forum.xda-developers.com/showpost.php?p=68495077&postcount=3 No Secure Settings, AutoTools etc.
For me - it works (on Nougat SlimRom 7 on HTC One 7).
It seems it needs root.
DeX1009 said:
It seems it needs root.
Click to expand...
Click to collapse
Of course... It can't be done without a root.
Unlocking AutoTools Secure Settings through ADB allows users to turn on/off GPS, and GPS can't be switched without root...
I have a Galaxy S8+. I use AMOLED Photo display mode, mostly because when I tweak a photo in Instagram, Snapseed,or Lightroom, I like it to be a fairly accurate representation on my phone's display, as the default Adaptive mode is oversaturated. But at other times, the Adaptive mode can look rather nice.
So what I'd like to do is when I launch something like Instagram or Snapseed, is to have Tasker switch the display mode to AMOLED Photo, and change back to Adaptive when I close the app.
It's a basic setting. Settings > Display > Display Mode > and you choose from one of 4 options with a radio button for each.
I tried using AutoInput, by using it to open display settings, then clicking display mode, then clicking AMOLED Photo. This is clunky, and slow, and the settings windows show on screen. And I then have to dismiss the settings window. Is there a way I can toggle that specific setting directly using some kind of plugin, without having to simulate all the key presses? Or have it change behind the scenes, not actually on screen?
Perhaps a shell command would work, if it has a specific system shell command? Is there a way to determine or interrogate if there is any kind of shell command?
Thanks!
the_scotsman said:
I have a Galaxy S8+. I use AMOLED Photo display mode, mostly because when I tweak a photo in Instagram, Snapseed,or Lightroom, I like it to be a fairly accurate representation on my phone's display, as the default Adaptive mode is oversaturated. But at other times, the Adaptive mode can look rather nice.
So what I'd like to do is when I launch something like Instagram or Snapseed, is to have Tasker switch the display mode to AMOLED Photo, and change back to Adaptive when I close the app.
It's a basic setting. Settings > Display > Display Mode > and you choose from one of 4 options with a radio button for each.
I tried using AutoInput, by using it to open display settings, then clicking display mode, then clicking AMOLED Photo. This is clunky, and slow, and the settings windows show on screen. And I then have to dismiss the settings window. Is there a way I can toggle that specific setting directly using some kind of plugin, without having to simulate all the key presses? Or have it change behind the scenes, not actually on screen?
Perhaps a shell command would work, if it has a specific system shell command? Is there a way to determine or interrogate if there is any kind of shell command?
Thanks!
Click to expand...
Click to collapse
I dont know about plugins, but you can check if there is a setting or intent regarding the display mode.
Run the following commands in terminal to see if there is a setting regarding display mode.
Code:
[B][COLOR="Blue"]# You can also write something like: settings list system > tasker.txt[/COLOR][/B]
settings list system
settings list global
settings list secure
[/HIDE]
You can change the settings which youve got from previous commands by using those commands:
Code:
[B][COLOR="Blue"]# Get the value/status of a setting[/COLOR][/B]
settings get global name_of_setting — returns status of setting (such as 1 = enabled, 0 = disabled)
[B][COLOR="Blue"]# Change the value/status of a setting[/COLOR][/B]
settings put global name_of_setting 0 — disables setting
settings put global name_of_setting 1 — enables setting
settings put system ...
settings put secure ...
[/HIDE]
You can also check if there is any intent for display mode in Settings.apk by using Manifest Viewer which shows the AndroidManifest.xml of every apk (where the intents are defined or something).
If there is a setting for display mode or if there is a intent, then its quite easy to set up a Tasker profile to achieve what you want.
You can also try to ask on Reddit ( /r/tasker ) since there are some people with good knowledge and /r/tasker is more popular than here on xda.
Thanks for your reply. You were on the right track. I had also asked on the Tasker Reddit.
But I need root to do what I want, and I'm not prepared to lose the warranty on my S8+ just yet.
Thanks anyway
Hey there,
so after recent problems with toggle data plugin/magisk for switching mobile data i decided to get toggles for mobile data and gps without other tools than tasker.
After some readings here and on stackoverflow i managed to get solutions for both without 3rd party apps.
So here it goes:
Mobile data toggle
Type - > RUN SHELL (use root)
Command:
Code:
setenforce permissive;
svc data enable; (or disable for off)
setenforce enforcing;
GPS location provider toggle
Type - > RUN SHELL (use root)
Command:
(for high accuracy)
Code:
settings put secure location_providers_allowed +gps;
settings put secure location_providers_allowed +network;
(for batery saving from high accuracy)
Code:
settings put secure location_providers_allowed -gps;
(for completly off from high accuracy)
Code:
settings put secure location_providers_allowed -gps;
settings put secure location_providers_allowed -network;
the toggle of mobile data will probably work with other solution for 2g toggle posted around here.
Solution tested on HTC10 with Nougat 7.0.
Hope it helps.
Plomiwn said:
Hey there,
so after recent problems with toggle data plugin/magisk for switching mobile data i decided to get toggles for mobile data and gps without other tools than tasker.
After some readings here and on stackoverflow i managed to get solutions for both without 3rd party apps.
<text removed from quote>
Click to expand...
Click to collapse
You tested this in Android 7.0,in 2017. I can confirm this still works in 9.0, on my OP6 running OOS :good:
Nothing beats shell commands - so damn effective, love them :highfive:
Kind Regards
TwinAdk
Here is the XML file for toggling GPS :highfive:
Run the task when needed, it take the current GPS status into consideration. The XML should be imported into Tasker.
Errors are logged to the clipboard (respecting existing content), and a flashing message will provide you with the result of the shell commands.
Full location is enabled (triangulation via GPS, wifi networks and cell towers).
This draws the most power but gives you the best location fix.
The Autolocation app is recommended for GPS tricks, and Autolocation for location-aware tasker tricks. None of these two apps can flip the GPS switch though... Previously I used the Secure settings app (AWESOME app) - but sadly it crashes constantly on later android versions (8 and 9 in my experience) - and all alternatives costs money.
Now we can flip that GPS switch ourselves. Why didn't I look into this earlier :silly:
God I love Android! :victory:
Kind Regards
TwinAdk
This is awesome.
I've been searching for a solution for Android Pie and this works perfect for me.
Plomiwn said:
Hey there,
so after recent problems with toggle data plugin/magisk for switching mobile data i decided to get toggles for mobile data and gps without other tools than tasker.
After some readings here and on stackoverflow i managed to get solutions for both without 3rd party apps.
So here it goes:
Mobile data toggle
Type - > RUN SHELL (use root)
Command:
Code:
setenforce permissive;
svc data enable; (or disable for off)
setenforce enforcing;
When I made a task in Tasker with this code when task is run my phone are restart and the task is disappear. It is normal?
Click to expand...
Click to collapse
gonzolex said:
Plomiwn said:
Hey there,
so after recent problems with toggle data plugin/magisk for switching mobile data i decided to get toggles for mobile data and gps without other tools than tasker.
After some readings here and on stackoverflow i managed to get solutions for both without 3rd party apps.
So here it goes:
Mobile data toggle
Type - > RUN SHELL (use root)
Command:
Code:
setenforce permissive;
svc data enable; (or disable for off)
setenforce enforcing;
When I made a task in Tasker with this code when task is run my phone are restart and the task is disappear. It is normal?
Click to expand...
Click to collapse
You don't need root to do that.
Just give permission to task via adb:
adb shell pm grant net.dinglisch.android.taskerm android.permission.WRITE_SECURE_SETTINGS
and you can active/deactivate secure settings by native action of tasker.
Click to expand...
Click to collapse
I have a profile to set a pin code when I am not near my home WiFi, using Secure Settings. It seems to work except the pin doesn't activate until I unlock the screen and relock it. Is there another step I need to have tasker do to jump start this.
Sent from my SM-T820 using Tapatalk
That's expected behavior. You can leave the pin always set and use a tasker shell action to set the lock screen timeout to a ridiculously long period at home. The command with a 10 day time out would look like:
settings put secure lock_screen_lock_after_timeout 86400000
Then the exit task would set the timeout back to a sane number:
Settings put secure lock_screen_lock_after_timeout 5000
notenoughtech.com has a write-up on using the shell in tasker to replace secure settings.
"Good judgment comes from experience, and a lot of that comes from bad judgment." - Will Rogers
Thanks. Unfortunately looks like that requires root. My phone is unrootable last I checked into it.
It actually does work once I turn screen on and back off since setting pin doesn't require root. Next step I'm going to see if having tasker turn the screen on and back off after setting the pin.
Disabling the pin when I'm back home works without issue.
Sent from my SM-T820 using Tapatalk
The AutoTools (paid) plugin for Tasker has a secure settings replacement. It doesn't require root, but gets permissions set through ADB commands.
In the tasker action:
plugins -> autotools -> secure settings
You can configure:
lock screen -> automatic lock
And set the time out for the lock screen similar to what I did above. It basically sets the same command I'm doing through the shell but doesn't require root.
"Good judgment comes from experience, and a lot of that comes from bad judgment." - Will Rogers
in my experience, this plugin Profile Shortcuts for LineageOS is the best to achieve this Secure Settings or AutoTools, you will have to depend on your ROM though, and cannot backup the profile.
Create 2 system profiles, leave everything unchanged, just use
Don't ask for PIN or password
and
Use system default
As Android is getting more and more 'secured', we user have less options to mess around on a system level. This method uses native system function, do it should work without problem.