From 922db53862080f7a165b1bf37dfb255e02868d51 Mon Sep 17 00:00:00 2001 From: Sam Bosley Date: Mon, 4 Mar 2013 17:14:02 -0800 Subject: [PATCH] Don't allow inactive sync providers (like gtasks) to sync in background --- .../astrid/sync/SyncV2BackgroundService.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/api/src/com/todoroo/astrid/sync/SyncV2BackgroundService.java b/api/src/com/todoroo/astrid/sync/SyncV2BackgroundService.java index 2c5b6ce50..9e6dded89 100644 --- a/api/src/com/todoroo/astrid/sync/SyncV2BackgroundService.java +++ b/api/src/com/todoroo/astrid/sync/SyncV2BackgroundService.java @@ -77,13 +77,15 @@ abstract public class SyncV2BackgroundService extends Service { if(!getSyncUtilities().isLoggedIn()) return; - getSyncProvider().synchronizeActiveTasks(false, new SyncResultCallbackAdapter() { - @Override - public void finished() { - getSyncUtilities().recordSuccessfulSync(); - context.sendBroadcast(new Intent(AstridApiConstants.BROADCAST_EVENT_REFRESH)); - } - }); + SyncV2Provider provider = getSyncProvider(); + if (provider.isActive()) + provider.synchronizeActiveTasks(false, new SyncResultCallbackAdapter() { + @Override + public void finished() { + getSyncUtilities().recordSuccessfulSync(); + context.sendBroadcast(new Intent(AstridApiConstants.BROADCAST_EVENT_REFRESH)); + } + }); } @Override