diff --git a/res/values/strings.xml b/res/values/strings.xml index 2e2fb0e28..a13634b4e 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -260,23 +260,18 @@ If you don\'t want to see the new task right after you complete the old one, you sync_dialogs Hide Dialogs Hide the Sync Results dialogs - sync_background - In Background - Synchronize without bothering you + Auto-Sync Wifi Only + If set, auto-sync only happens when Wifi is active Sync Error! Sorry for the inconvenience! Error: In order to synchronize, please log in to your %s account and authorize Astrid to read your data. \n\n When finished, restart Astrid and come back here. - -Welcome to Astrid\'s RTM sync! -\n\n -Things that don\'t sync:\n -- Notifications and repeats\n -- In RTM, deleting, or moving+renaming tasks\n -\n -Wish me luck!\n + +Astrid 2.7 now performs synchronization with RTM in the background. You will +be directed to the preferences page to configure how often you want this to +occur (it is a minor drain on battery). Synchronize Now! Clear Personal Data diff --git a/src/com/timsu/astrid/sync/SynchronizationService.java b/src/com/timsu/astrid/sync/SynchronizationService.java index ddbdc08c5..ac92e4cc9 100644 --- a/src/com/timsu/astrid/sync/SynchronizationService.java +++ b/src/com/timsu/astrid/sync/SynchronizationService.java @@ -12,6 +12,14 @@ import android.util.Log; import com.timsu.astrid.utilities.Preferences; +/** + * SynchronizationService is the service that performs Astrid's background + * synchronization with online task managers. Starting this service launches + * the timer, which handles timing for synchronization. + * + * @author Tim Su + * + */ public class SynchronizationService extends Service { /** Service timer */ @@ -32,7 +40,7 @@ public class SynchronizationService extends Service { return; Intent service = new Intent(context, SynchronizationService.class); - context.stopService(service); + context.startService(service); } public static void stop() { diff --git a/src/com/timsu/astrid/utilities/StartupReceiver.java b/src/com/timsu/astrid/utilities/StartupReceiver.java index b8f9f402a..84ea14772 100644 --- a/src/com/timsu/astrid/utilities/StartupReceiver.java +++ b/src/com/timsu/astrid/utilities/StartupReceiver.java @@ -1,14 +1,18 @@ package com.timsu.astrid.utilities; -import com.timsu.astrid.sync.SynchronizationService; - import android.content.BroadcastReceiver; import android.content.Context; +import android.content.DialogInterface; import android.content.Intent; +import android.content.DialogInterface.OnClickListener; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.util.Log; +import com.timsu.astrid.R; +import com.timsu.astrid.activities.SyncPreferences; +import com.timsu.astrid.sync.SynchronizationService; + public class StartupReceiver extends BroadcastReceiver { private static boolean hasStartedUp = false; @@ -42,11 +46,18 @@ public class StartupReceiver extends BroadcastReceiver { if(latestSetVersion <= 99) { if(Preferences.getSyncOldAutoSyncFrequency(context) != null) { float value = Preferences.getSyncOldAutoSyncFrequency(context); - Preferences.setSyncAutoSyncFrequency(context, + Preferences.setSyncAutoSyncFrequency(context, Math.round(value * 3600)); + DialogUtilities.okDialog(context, context.getResources().getString( + R.string.sync_upgrade_v99), new OnClickListener() { + public void onClick(DialogInterface dialog, + int which) { + context.startActivity(new Intent(context, SyncPreferences.class)); + } + }); } } - + new Thread(new Runnable() { public void run() { Notifications.scheduleAllAlarms(context); @@ -64,7 +75,7 @@ public class StartupReceiver extends BroadcastReceiver { SynchronizationService.setContext(context); Intent service = new Intent(context, SynchronizationService.class); context.startService(service); - + hasStartedUp = true; } }