Hi Martin,
Can we get the sync status from the system?
For example if I want to know if sync is initiated, or running or complete for a particular account-service combination (ex Google-contacts)?
Can this be done?
Condition - Account Sync - To get sync status
Moderator: Martin
- Automagician.gaurav
- Posts: 15
- Joined: 25 Aug 2017 18:13
Condition - Account Sync - To get sync status
Thanks for reading this post.
- Gaurav
Automagician, India
- Gaurav
Automagician, India
Re: Condition - Account Sync - To get sync status
Hi,
There's currently no way to check if a sync is actively running at the moment. There's only a condition Auto Sync Enabled to check if auto sync is enabled for a particular Account/Authority.
How would you like to use this feature? Would a condition be enough or would a trigger be more appropriate to be informed as soon as a sync starts/ends?
Regards,
Martin
There's currently no way to check if a sync is actively running at the moment. There's only a condition Auto Sync Enabled to check if auto sync is enabled for a particular Account/Authority.
How would you like to use this feature? Would a condition be enough or would a trigger be more appropriate to be informed as soon as a sync starts/ends?
Regards,
Martin
- Automagician.gaurav
- Posts: 15
- Joined: 25 Aug 2017 18:13
Re: Condition - Account Sync - To get sync status
Hi Martin,
Thanks for replying.
I have a flow which turns on sync when I plug in my phone.
I just want to be able to know that sync is complete before I turn it off again (to save battery).
I also want to sync some of the services on my phone every other hour, like emails. But the time taken by the sync to complete is inconsistent, majorly due to network issues. (Yep this is an issue in India). So I cannot just turn it off after say 10 minutes.
So..if you can create a trigger, for every start / stop of Sync
OR
If you can create a condition to check the status of synchronisation
OR
Suggest me any other way to access the last time a particular account / service was Synced successfully
It will work..
Thanks
Thanks for replying.
I have a flow which turns on sync when I plug in my phone.
I just want to be able to know that sync is complete before I turn it off again (to save battery).
I also want to sync some of the services on my phone every other hour, like emails. But the time taken by the sync to complete is inconsistent, majorly due to network issues. (Yep this is an issue in India). So I cannot just turn it off after say 10 minutes.
So..if you can create a trigger, for every start / stop of Sync
OR
If you can create a condition to check the status of synchronisation
OR
Suggest me any other way to access the last time a particular account / service was Synced successfully
It will work..
Thanks
Thanks for reading this post.
- Gaurav
Automagician, India
- Gaurav
Automagician, India
Re: Condition - Account Sync - To get sync status
I would say trigger is better, something like "Sync finished". There is no general broadcast for sync finished. I look at stackoverflow, there are some code to detect the syncadapter has finished the sync.
If it is a condition, we have to loop over to check again every several minutes. We can't get the exact time the sync finished. The flow will run too many times just to check.
Using trigger, the event is instant so there will be no delay and no need to loop. In case we still need it as condition, we can make it using the trigger. Set a global_is_syncing to 1 at the beginning of sync, then check this using expression. If the sync finish, use script to set it to 0. That way we can create our own condition from the trigger if needed. So trigger is better, since the sync finished should be an event, not a state.
As for "Sync Started", I don't know if it is possible. But if it is, then it will one pair with "Sync finished", just like app task started and ended pair.
If it is a condition, we have to loop over to check again every several minutes. We can't get the exact time the sync finished. The flow will run too many times just to check.
Using trigger, the event is instant so there will be no delay and no need to loop. In case we still need it as condition, we can make it using the trigger. Set a global_is_syncing to 1 at the beginning of sync, then check this using expression. If the sync finish, use script to set it to 0. That way we can create our own condition from the trigger if needed. So trigger is better, since the sync finished should be an event, not a state.
As for "Sync Started", I don't know if it is possible. But if it is, then it will one pair with "Sync finished", just like app task started and ended pair.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
Re: Condition - Account Sync - To get sync status
I think that a trigger to detect sync started and sync ended should be possible however the documentation provided by Google is very incomplete so there might be unpleasant surprises...
I add it to the list of features to check the feasibility.
If you just want to sync once, you could also turn off auto-sync completely and use action Request Sync to force a manual sync without turning the auto sync on at all.
Regards,
Martin
I add it to the list of features to check the feasibility.
If you just want to sync once, you could also turn off auto-sync completely and use action Request Sync to force a manual sync without turning the auto sync on at all.
Regards,
Martin
- Automagician.gaurav
- Posts: 15
- Joined: 25 Aug 2017 18:13
Re: Condition - Account Sync - To get sync status
Martin, Thanks a lot for replying.
I changed it so it just requests sync once now without turning on the Auto sync. And that serves my purpose for now.
So now its
Plugged in --> Auto Sync on
Plugged out --> Auto Sync off
Manual Sync every hour when not plugged in.
Thanks again
I changed it so it just requests sync once now without turning on the Auto sync. And that serves my purpose for now.
So now its
Plugged in --> Auto Sync on
Plugged out --> Auto Sync off
Manual Sync every hour when not plugged in.

Thanks again
Thanks for reading this post.
- Gaurav
Automagician, India
- Gaurav
Automagician, India
Re: Condition - Account Sync - To get sync status
I think so right ?