Enabled Profile When Autosync is disabled

329 views
Skip to first unread message

Amer

unread,
Jan 25, 2012, 1:57:07 AM1/25/12
to tas...@googlegroups.com
as subject, I have a profile that I need to enabled when Autosync is disabled and vise versa.

any idea on how to do that.

--


Be first, be better, or cheat.™

Pent

unread,
Jan 25, 2012, 3:30:36 AM1/25/12
to Tasker

> as subject, I have a profile that I need to enabled when Autosync is
> disabled and vise versa.
>
> any idea on how to do that.

Not possible using only Tasker as far as I'm aware.

Pent

Amer

unread,
Jan 25, 2012, 3:51:09 AM1/25/12
to tas...@googlegroups.com

Any plugin or 3rd app you might hear to achieve this pent?

Pent

unread,
Jan 25, 2012, 4:05:28 AM1/25/12
to Tasker
> Any plugin or 3rd app you might hear to achieve this pent?

I think you could use some linux tools to analyse the settings
database, but I don't know any details.

Pent

Amer

unread,
Jan 25, 2012, 4:14:55 AM1/25/12
to tas...@googlegroups.com

Ok, thx for the quick response

sayling

unread,
Feb 7, 2012, 5:59:25 AM2/7/12
to Tasker
May be the answer can come from a different approach?

What is enabling and disabling the sync at the moment? Could that be
replaced by a task, and within that task toggle the sync?

On Jan 25, 9:14 am, Amer <moamer.khad...@gmail.com> wrote:
> Ok, thx for the quick response

Amer

unread,
Feb 7, 2012, 8:10:06 AM2/7/12
to tas...@googlegroups.com
yes. if, it is posibble that way. and it's my current solution

TomL

unread,
Feb 7, 2012, 8:26:06 AM2/7/12
to tas...@googlegroups.com
Here's how I used to detect whether or not Auto-Sync was enabled on my Droid:

#!/system/xbin/ash

# write into file current state of autosync setting
# 1
# 0

OUTFILE="/sdcard/autosync.txt"
AS=$((1 - `su -c "grep listen-for-tickles /data/system/sync/accounts.xml" | wc -l`))
echo $AS > $OUTFILE
echo $AS

return

Amer

unread,
Feb 7, 2012, 8:53:04 PM2/7/12
to tas...@googlegroups.com
thx! i presume i use it with locale execute plugin?
will try this for sure

TomL

unread,
Feb 8, 2012, 7:52:39 AM2/8/12
to tas...@googlegroups.com
You have root right? You want to try this step by step, or else troubleshooting it will be a pain.

1. First disable AutoSync and run this command from your terminal shell as root:

grep listen-for-tickles /data/system/sync/accounts.xml

With luck, this will return something like: "listen-for-tickles=false"

Then enable AutoSync and run the command again:
 
grep listen-for-tickles /data/system/sync/accounts.xml

Again, with luck, this time you'll get back nothing.  That's how you'll program-matically detect the two states.  

2. Everything else is just refinements:

grep listen-for-tickles /data/system/sync/accounts.xml | wc -l 

will return 1 for AutoSync disabled, 0 for enabled.  

3. To make the values more normal, flip it around this way:

echo $((1 - `grep listen-for-tickles /data/system/sync/accounts.xml | wc -l`)) 

will return 1 for AutoSync enabled, 0 for disabled. 

4. I would use the Secure Settings plugin to execute the shell command, since it can run commands as root, and it can accept return values from the shell command.  That's more elegant than the write value into a file and then read it from the file method I used.

Tom

Amer

unread,
Feb 8, 2012, 12:38:21 PM2/8/12
to tas...@googlegroups.com

Great solution! It works and case closed!

Thx a million to you!

--
[OS] Android Gingerbread 2.3.7
[Phone] HTC Desire S
[ROM] CyanogenMod 7.1
[Kernel] Tiamat Saga 1.1.5+
[Recovery] 4EXTRecovery v2.1.0

Amer

unread,
Feb 8, 2012, 11:58:33 PM2/8/12
to tas...@googlegroups.com
just an update.

I've been doing trial and error between the secure setting plugin and locale execute plugin for this profile and for the other one (get email info from gmail app) and it seems that, in my case, the secure setting will not run unless the screen is on(or awake?) but the locale execute will still run even if the screen is off.

it's to bad actualy because in term of speed, secure execute is faster because it doesn't need the "read line from file" action.

:)

TomL

unread,
Feb 9, 2012, 7:56:49 AM2/9/12
to tas...@googlegroups.com
You're welcome!  

Secure Settings has a "Wake Device" cmd, you could do:

1. secure settings > wake device
2. secure settings > run shell command
etc...

Tom
Reply all
Reply to author
Forward
0 new messages