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

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

Related

Lock access to certain apps and settings

Dear Tasker-Masters,
My goal:
I want to limit the use of certain apps on my son's phone (running CM12.1) using tasker. Some apps (basically games) are time-limited, others shall not be accessible at all.
What I did (apart from deactivating the guest account):
I've defined a profile "No access" that activates when certain apps start (including play store and settings). This profile starts a task calling for a lock screen asking for a code. Locking settings is especially needed to deactivate the option to developer options and root access, access to other appstores, or the device admin section.
What my son did:
He found out, that the locked app appears in the app history. Clicking the locked app in the history immediatly brings up the lockscreen. However, there's a tiny time frame of maybe 0.1 seconds, where the locked app reacts to strokes on the display. This way, it's possible to scroll down the "setting" app until you get to the "security" and "device admin" section, and then to disable tasker from there. Now, profiles cannot read or react to whatever appears in the foreground of the display.
My question:
1. Can you think about a secure way to lock access to android settings? How would that be?
2. is it possible to deactivate the appearence of (only!) the android settings in the app history?
1. Create a profile -> Application -> Settings. This will trigger when someone goes into the settings app (yes even settings its an app).
In the task itself you can just "Go Home".
The task will trigger even if he goes to the settings from the recent app screen.
2. If your phone is rooted then just kill the settings app from running.
If not use AutoInput to press that "kill all" button (unfortunately).
Make sure also that tasker is a device administrator. You don't want your son to "accidentally" uninstall it.
You can't uninstall device admin apps without turning off that setting and he cant go into settings.
I hope these guidelines will help you.

Mobile Data, GPS toggle [ROOT] no plug-ins

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

[Guide][OOS][Root][Tasker] Disable visual annoyances during night

Hello guys, i'm no tasker expert, but i'll try to share my setup in order to turn off automatically notification (pulse) led, charging led and new notification wake up screen (under ambiant display) using tasker.
Requirements:
OOS (most custom roms have these things natively, and commands may differ from rom to rom)
Root
tasker
If you're new to tasker and need more step by step guide to create a task, there are plenty of tutorials and videos for that :good:.
First thing to understand is that there are multiple commands, you can choose to merge all the ones to disable lights into one task, and all the ones to enable lights back into another task, that's the easier way, but you can choose to make individual tasks that will be called one by one in another "main task", that's up to you, but the second choice will ask some extra work.
All the tasks will be created the same way, so i'll just help you with the first, then simply redo the things with the other commands.
Let's start with charging led, I named it LightsOff but you can name any task like you want.
Go to thet tasks tab, hit the "+" in the lower right, then name your task (LightsOff ?), then hit again the "+", type shell in the search field and select the "run shell", then, you'll need to type the different commands to be ran, one by line, so it meens after each command, hit "enter"
Once you're done, don't forget to tick the root checkbox.
For example, to turn the charging led Off you'll need the following commands:
Code:
settings put system battery_light_full_color 00
settings put system battery_light_medium_color 00
settings put system battery_light_low_color 00
There are other commands to turn it off, but for some reason, turn it back on will require a reboot, so to avoid that, i simply changed the colors to black, so it's not really turned off, but black (which is, for us, exactly the same).
You'll find all the commands at the end of the post, if you want to merge all commands (recommanded) into one task, go there and just add them to the task before saving it.
Save the task.
Now let's make the task that will get your charging led back to normal (or whatever suits you).
It's almost a copy and paste as the only changes are the name of the task (LightsOn ?) and the values for the colors.
Commands to type:
Code:
settings put system battery_light_full_color 16711936
settings put system battery_light_medium_color 16842752
settings put system battery_light_low_color 16842752
Save the task (root ticked obviously).
These are the default values, you can try other values if you like, that's what i've done, i like dimmed lights for charging, so mines are
Code:
settings put system battery_light_full_color 4096
settings put system battery_light_medium_color 8126464
settings put system battery_light_low_color 8126464
Before you ask, i could not find how find the correct number for a wanted color, i just tried many and wrote down ones i could keep, if you have an idea let's share it
So, now, here are the other commands that you can choose to merge to the first task or just create more tasks for each.
Wake up screen on new notification (you can find it under the ambiant display menu)
Warning: not same command as before, this setting is stored in the secure settings, not the system settings
Disable:
Code:
settings put secure notification_wake_enabled 0
Enable:
Code:
settings put secure notification_wake_enabled 1
And for the pulsing notification light.
Disable:
Code:
settings put system notification_light_pulse 0
Enable:
Code:
settings put system notification_light_pulse 1
You can merge all the commands in one single task for enable and another for disable if you want, that will be easier to setup.
Now all you have to do is create a new profile for night based on time of the day that will trigger the lights off.
Go to profiles tab, hit the "+" then "time" and choose the hours that suits you.
then select the task you want to run (the one that will turn off everything), after that, long click on the selected tak and select "add exit task"
then select the task that will turn all back on.
If you merged all the commands you're done, if not, you'll need to crete two tasks that will group the different tasks you want, i don't thinks it's worth the extra work but for knowledge purpose here's what you have to do.
Go to Tasks Tab, hit "+", give a name, hit "+" type "perform" in the search field and then select "perform task", hit the magnifying glass (the search icon, sorry english isn't my native language) then select the task you want, repeat this for each task you want to add to the "main" task.
Do the same for the "exiting" task.
This way is better as you can add extra tasks like going to airplane mode or mute sounds or whatever you want, but i i told before, it's much more work.
Hope this will help some stock (or xXx :good users, if you have questions, i'll try to answer, but as i said earlier, i'm really no expert with tasker, but if i could manage to do it, you too !
Have a nice day XDA !

PSA/Guide - How to set custom tones in Gmail, hide "running in background.."

PSA/Guide - How to set custom tones in Gmail, hide "running in background.."
The solution is not my own, I found a post where someone tried to hide a running process notification. But it gave me an idea. And boy, was I correct.
So, what's the fuss about?
Apparently, Huawei's skin (EMUI) loves to not only change how Android works, but it also hides some functions. Such function is custom notification tones for accounts in Gmail. And the option to hide "running in the background" notification.
How do you get this function back?
- Use an activity launcher, or a custom Launcher like Nova.
- Open "Settings", and look for "App notifcations" (".Settings$NotificationAppListActivity").
This will grant you ALL the options you might be missing from pure AOSP/Android.
- tested and confirmed on EMUI 8.1 (GPU Boost update)
How to set Gmail tones?
1) Open Gmail from the new Activity
2) Tap your account you want to modify
3) ???
4) Profit
How to hide running...
1) Tap top-left "..."
2) Show system processes
3) find Android System
4) ???
5) Profit!
What? Sorry but your instructions are as clear as mud.
Hoo boy, I was going to write a guide explaining how to access notification importance and the Do Not Disturb override from EMUI. When I wrote the title, XDA found this thread as similar.
If you're on EMUI and you're looking desperately for how to set an app's notification importance (urgent, high, normal or low), and set it to override do not disturb settings, follow the steps in the OP! If you need a specific activity launcher, you can download Activity Launcher from Google Play (unfortunately I didn't find the app on APK Mirror).
Thnx for the tip!!
Download App Shortcut Maker, search for the activity needed and create a shortcut.

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