Nice!
Does anybody know of a action to stop facebook alerts? I'm using the Auto-sync off which is stopping Gmail alerts, but would like to stop Facebook alerts as well while I'm in the office
I hate the battery drain of Facebook, so I have a task that turns off GPS, since Facebook doesn't respect this setting all the time, unfreezes Facebook, launches it, then checks every two seconds to see if its running and if I've exited, it refreezes it. This of course requires root. Also, I've found that the method of how exactly I do things at the command line varies from phone to phone and andriod version to the next as well.
In any case, if you happen to use location based settings or can pin it down to wifi connected at work, you could incorporate something along these lines, that Facebook is frozen at work but when you leave, screen on, unfreeze, launch, close and don't freeze, screen off.
I've used both just plain shell scripts written as files, one as the user and then that launches the Facebook running monnitor as a child to the first script, but this doesn't work in Jellybean 4.2.2
I've also used sl4a but again there's problems with it as of recently when I switched to my newest phone.
Now, I have to run everything at the shell as one big single string with semicolons separating each command. Its quite annoying.
In any case, the task looks like this:
1. Vibrate 60 (So I know I actually pressed the shortcut)
2. Variable Set
-%gps to %GPS
3. Secure Settings
-GPS Disabled
--if %GPS ~ on
4. Run shell (as root checked)
- pm enable com.facebook.katana
5. Load App
- Facebook
6. Run shell (as root checked and continue after error UNchecked)
- sleep 2 ; x=`dumpsys activity | grep com.facebook.katana/.LoginActivity` ; while [ "$x" != "" ] ; do sleep 2 ; x=`dumpsys activity | grep com.facebook.katana/.LoginActivity`; done ; pm disable com.facebook.katana
7 Secure Settings
- GPS Enabled
-- if %gps ~ on
8. Flash Facebook Done
Note that you need to select the Facebook App icon before its frozen and create the shortcut on the desktop while Facebook isn't frozen. It can be backgrounded and done at this point if it wasn't done before running the task and exiting, which freezes the app making the app icon unselectable.
If you have anything set up so that Tasker knows you're at work, you can just add, as root via shell script, or sl4a if you prefer: pm disable facebook.katana and when you leave: pm enable com.facebook.katana but you'de have to launch it for the notifications to come so you'de use Secure settings to unlock the screen (use notification popup for 2 seconds if it doesn't work on its own, then Secure Settings), open the app com.facebook.katana/.LoginActivity, close com.facebook.katana/.LoginActivity , then turn the screen off and lock it if you need it locked.
This isn't the same thing as adjusting your settings but its sort of a workaround. The other thing would be to look in /data/data/com.facebook.katana and poke around for a file you might be able to use tasker (need root for this too) to stop facebook (Facebook is so relentless it sort of has to be frozen in order to stop it) that might have the settings in it so you could copy them to another location on the data partition and have tasker copy the appropriate one back then unfreeze it, unlock the screen, start it...
You'de want to back up the whole folder (on the same partition /data in this case as you'de lose file permisssions if you move it to internal or external storage), before trying it out. The goal would also be not to screw up any cache it had stored but seek out just the settings if its possible... don't want to lose new message notifications and whatnot.
Foldername might change with a number at the end on updates so using a * wildcard would be helpfull in this scenario.
The Facebook profile above works well with Maps as well for phones that have a heavy drain from Maps. It seems I have less with my newer phone but I still have it frozen until I use it. In the case of Maps, GPS and Wifi are turned on with their original values stored in a local variable as GPS was in Facebook and the activity to look for in dumpsys is com.google.android.maps/com.google.android.maps.MapsActivity
In both cases, with Facebook and Maps, this allows you to background the app, or in the case of Facebook, link off to something from Facebook, and it will remain running until you actually come out of the process entirely as you normally would, or if you have a back to kill mod then that works a lot easier; they still get all the other services spawned frozen and killed. With Facebook you want to be sure to exit the app or you're putting in your pocket with the shell still adding a new increasing PIDs every 2 seconds. I don't know how high you want to go on Android but I haven't had any problems so far and can have quite a bit of uptime at times.