Mobile Data, GPS toggle [ROOT] no plug-ins - Tasker Tips & Tricks

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

Related

Tasker - Facebook app enable when you want to use, task to disable when app closes

I was trying to find a way to completely disable all of the background stuff that runs with the andriod facebook app and couldn't find an elegant way of doing it. Greenify sort of works but the background process somehow always find a way to restart themselves.... With this you can simply launch a facebook tasker link task, tasker will enable or 'unfreeze' the facebook app. Then when your done with facebook, as soon as you close it, a task will run to automatically disable or 'freeze' it. I noticed after this my battery life definitely improved.
As this is actually my first post on xda, I can't post the links to the screenshots I took of the tasker screens If anyone wants I have it in an html page / word doc that shows step by step the tasker profile and 4 tasks. PM me.)
Requirements
-Tasker
-Root
-Secure Settings tasker plugin and Root item > Package State > enable
-If you cannot get secure settings to recognize root (whcih was the case for me) then you need to run the following (which I found on another post)
download a terminal emulator then run the commands below
Play store - Terminal Emulator for Android, Jack Palevich
su
mount -o remount,rw /system
touch /system/bin/su
mount -o remount,ro /system
reboot
1) Create Profile > Application > Facebook
2)Create a “Facebook start” task
TASK #1: 'Facebook start' > Launch app Facebook
3) Then on the “Facebook” profile click on the ‘facebook start’ and select Add Exit Task
Then choose the a task that you created called ‘Facebook disable’
TASK #2: 'Facebook disable' > Secure Settings plugin > Facebook app > disable
TASK #3: 'Facebook enable' (this is to be used as a generic way to enable facebook and also used in the TASK#4). > Secure Settings plugin > Facebook app > enabled
TASK #4: 'Facebook Launch' (this enables the facebook app then launches facebook).
>perform task 'facebook enable'
>Wait 5 seconds
>Flash 'launching facebook'
>Launch App > Facebook
For the Facebook Icon to show on this task #4, you can choose this by pressing on the bottom right of the task and application Icons
4) Then Create a Tasker Widget Shortcut (don’t use the native Facebook icon as it will disappear from your launcher when you disable the app then you will have to keep re-adding it to the screen…) and point it to Task #4 'facebook launch'
Place your tasker shortcut on your launch screen and you are good to go. Now when you launch it, it will enable facebook, then when you exit , it will disable it.
You can do this for virtually any app, but I found it most useful for Facebook as it drains the battery when its enabled
What about doze? Do I need this tasker profile if my Android use doze?
noorbertt said:
What about doze? Do I need this tasker profile if my Android use doze?
Click to expand...
Click to collapse
I have a Galaxy S5 and am on MarshMallow I find that even if doze is enabled, facebook always finds a way to run. It was constantly draining my battery and until I did this tasker thing my battery would run down quickly. I'd recommend downloading an app from the playstore called "OS Monitor" - it shows what apps are running and how much CPU they are consuming - you can set it to show in real time - similar to windows task manager
Which option do you use in secure settings. I am not able to find any app actions in mine.
iamronin said:
Which option do you use in secure settings. I am not able to find any app actions in mine.
Click to expand...
Click to collapse
Secure Settings tasker plugin and Root item > Package State > enable
-If you cannot get secure settings to recognize root (whcih was the case for me) then you need to run the following (which I found on another post)
download a terminal emulator then run the commands below
Play store - Terminal Emulator for Android, Jack Palevich
su
mount -o remount,rw /system
touch /system/bin/su
mount -o remount,ro /system
reboot
If someone is interested in this feature but doesn't want to mount their system and break SafetyNet here is what I did. Instead of using Secure Settings I use a shell command. I've edited the original post:
drum200910 said:
Requirements
– Tasker
– Root
1) Create Profile > Application > Facebook
2) Create a “Facebook start” task
TASK #1: 'Facebook start' > Launch app Facebook
3) Then on the “Facebook” profile click on the ‘facebook start’ and select Add Exit Task
Then choose the a task that you created called ‘Facebook disable’
TASK #2: 'Facebook disable' > Code > Run Shell > Command "pm disable com.facebook.katana" and select "Use Root"
This only work with permissive SELinux, though. If you have enforcing SELinux you might have to add this command before the main one "setenforce 0" (also with root) and if you want to still pass SafetyNet after the main command run "setenforce 1" (also with root).
TASK #3: 'Facebook enable' (this is to be used as a generic way to enable facebook and also used in the TASK#4). > Code > Run Shell > Command "pm enable com.facebook.katana". Again with the other two.
TASK #4: 'Facebook Launch' (this enables the facebook app then launches facebook).
>perform task 'facebook enable'
>Wait 5 seconds
>Flash 'launching facebook'
>Launch App > Facebook
For the Facebook Icon to show on this task #4, you can choose this by pressing on the bottom right of the task and application Icons
4) Then Create a Tasker Widget Shortcut (don’t use the native Facebook icon as it will disappear from your launcher when you disable the app then you will have to keep re-adding it to the screen…) and point it to Task #4 'facebook launch'
Place your tasker shortcut on your launch screen and you are good to go. Now when you launch it, it will enable facebook, then when you exit , it will disable it.
You can do this for virtually any app, but I found it most useful for Facebook as it drains the battery when its enabled
Click to expand...
Click to collapse
Filip013 said:
If someone is interested in this feature but doesn't want to mount their system and break SafetyNet here is what I did. Instead of using Secure Settings I use a shell command. I've edited the original post:
Click to expand...
Click to collapse
In this part above: TASK #3: 'Facebook enable' (this is to be used as a generic way to enable facebook and also used in the TASK#4). > Code > Run Shell > Command "pm disable com.facebook.katana". Again with the other two.
should the above be "pm enable com.facebook.katana" ? I tried enable and it did work. Just checking...
saxainpdx said:
In this part above: TASK #3: 'Facebook enable' (this is to be used as a generic way to enable facebook and also used in the TASK#4). > Code > Run Shell > Command "pm disable com.facebook.katana". Again with the other two.
should the above be "pm enable com.facebook.katana" ? I tried enable and it did work. Just checking...
Click to expand...
Click to collapse
Thanks. That was a typo.
Let me give you a better and quick way to freezing/de-freezing a app whenever required:
Requisites:
1. Root
2. Titanium Backup
3. Nova Launcher or any other launcher
Steps:
After installing Titanium backup successfully go to Launcher and add widget of Titanium Backup with type as Action (There will be two widgets, Select the first one)
In the screen, tap on the action and select Freeze/Defrost/Launch an app (Scroll up then you will see)
Tap on Filter by and select the target application
Done
You widget will be created and whenever you tap on it a. If the app is frozen then it will get defrosted and get launched b. If its not frozen then it will get frozen
I am using this method since a year already for Facebook and Messenger apps

[Q] Auto airplane mode with Nougat (AutoTools or similar)?

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...

Location settings

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.

Android 12: Toggle LTE Only

Hi
with Android 11 and the older versions tasker was able to toggle the phone to lte only, 2g, 3g etc.
With Android 12 this is not working anymore.
Does anybody know a solution for this?
I'm on Andoid older than 12.
I use custom settings > system > voicecall_type1 > value 0
In Adroid 12 may be not working.
Well I'll be damned, I found the solution and have to share! Create a Bixby routine triggered by a notification and then have tasker create and immidiately after cancel the notification. Bixby routines picks it up (while you don't even see it) and has the permissions to change network type
https://www.reddit.com/r/tasker/comments/s9rpqw

AOD off task when face down

Can somebody help me with a task to turn off aod when face down or in pocket on a samsung s21 FE?
Thanks!
Not bullet proof but you can give it a try...........
creat a new task > custom setting > system > aod_mode > value 0
create a new profile > find sensor or gesture > find face down
add the above task to the profile.
** you can reverse aod on I believe is using value 1
eeeemc said:
Not bullet proof but you can give it a try...........
creat a new task > custom setting > system > aod_mode > value 0
create a new profile > find sensor or gesture > find face down
add the above task to the profile.
** you can reverse aod on I believe is using value 1
Click to expand...
Click to collapse
Sadly it doesn't work.
But thanks
last resort ............
same as previous nmethod but change aod_mode to:
aod_tap_to_show_mode
use value 0
Actually I'm on Samsung A71 and using such methods
Mrawy said:
Sadly it doesn't work.
But thanks
Click to expand...
Click to collapse
eeeemc said:
last resort ............
same as previous nmethod but change aod_mode to:
aod_tap_to_show_mode
use value 0
Actually I'm on Samsung A71 and using such methods
Click to expand...
Click to collapse
It doen't work, maybe I need to give tasker some permissions trough adb?
Mrawy said:
It doen't work, maybe I need to give tasker some permissions trough adb?
Click to expand...
Click to collapse
I'm not sure if extra permission is required as not in my case.
May be try below experimental task if it works so that it proofs tasker custom settings is available on your device :
custom settings > system > blue_light_filter > value 1
This turn on Samsung's reading mode and if you manually hit play button from within tasker after you create this blue light test task , then you check from the dropdown tilt to see if the blue light icon is on or not.
if it is on , means custom setting is availble on your device without extra permission.
if this is the case , use custom setting to use the 'FIND' button step-by-step go to AOD on/off menu and set it. ( hope you know custom setting has 'FIND' function to manually choose the require action in your case is to find the AOD )
On Huawei P30 Pro, to disable AOD make task like a photos in attachment.
To use this task You Need use ADB DEBUGGING and Tasker Permissions app or adb command. Read more:
https://tasker.joaoapps.com/userguide/en/help/ah_secure_setting_grant.html
I toggle my AOD on my Samsung device. It's just as the first reply said.
custom setting > system > aod_mode > value 0 to turn it off, and 1 to turn it on.
To test the adb setting on your device, just create a simple task that toggles AOD. EG when you are connected to wifi, set it off, or somethign else you can use to easily test.
If that works (which it should), then it's the sensor part that has the issue.

Categories

Resources