Can start sync intent with any kind of action. Created two new manifest actions for starting sync from third party apps like Tasker

pull/14/head
Tim Su 14 years ago
parent 22cd64bda9
commit 93ac196557

@ -253,7 +253,12 @@
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<service android:name="com.todoroo.astrid.gtasks.GtasksBackgroundService"/>
<service android:name="com.todoroo.astrid.gtasks.GtasksBackgroundService">
<intent-filter>
<action android:name="com.todoroo.astrid.gtasks.SYNC" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</service>
<receiver android:name="com.todoroo.astrid.gtasks.GtasksSyncActionExposer">
<intent-filter>
<action android:name="com.todoroo.astrid.REQUEST_SYNC_ACTIONS" />
@ -437,7 +442,12 @@
</activity>
<activity android:name="com.todoroo.astrid.producteev.ProducteevLoginActivity"
android:theme="@style/Theme" />
<service android:name="com.todoroo.astrid.producteev.ProducteevBackgroundService"/>
<service android:name="com.todoroo.astrid.producteev.ProducteevBackgroundService">
<intent-filter>
<action android:name="com.todoroo.astrid.producteev.SYNC" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</service>
<receiver android:name="com.todoroo.astrid.producteev.ProducteevStartupReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />

@ -15,7 +15,6 @@ import com.todoroo.andlib.service.DependencyInjectionService;
import com.todoroo.astrid.api.AstridApiConstants;
import com.todoroo.astrid.api.SyncAction;
import com.todoroo.astrid.service.AstridDependencyInjector;
import com.todoroo.astrid.sync.SyncBackgroundService;
/**
* Exposes sync action
@ -38,7 +37,7 @@ public class GtasksSyncActionExposer extends BroadcastReceiver {
if(!gtasksPreferenceService.isLoggedIn())
return;
Intent syncIntent = new Intent(SyncBackgroundService.SYNC_ACTION, null,
Intent syncIntent = new Intent(null, null,
context, GtasksBackgroundService.class);
PendingIntent pendingIntent = PendingIntent.getService(context, 0, syncIntent, PendingIntent.FLAG_UPDATE_CURRENT);
SyncAction syncAction = new SyncAction(context.getString(R.string.gtasks_GPr_header),

@ -49,7 +49,6 @@ import com.todoroo.astrid.gtasks.GtasksBackgroundService;
import com.todoroo.astrid.gtasks.GtasksPreferenceService;
import com.todoroo.astrid.service.AstridDependencyInjector;
import com.todoroo.astrid.service.StatisticsService;
import com.todoroo.astrid.sync.SyncBackgroundService;
import com.todoroo.gtasks.GoogleConnectionManager;
import com.todoroo.gtasks.GoogleLoginException;
import com.todoroo.gtasks.GoogleTasksException;
@ -172,7 +171,7 @@ public class GtasksLoginActivity extends Activity {
* Perform synchronization
*/
protected void synchronize() {
startService(new Intent(SyncBackgroundService.SYNC_ACTION, null,
startService(new Intent(null, null,
this, GtasksBackgroundService.class));
finish();
}

@ -47,7 +47,6 @@ import com.todoroo.astrid.gtasks.GtasksTaskListUpdater;
import com.todoroo.astrid.gtasks.auth.GtasksLoginActivity;
import com.todoroo.astrid.service.AstridDependencyInjector;
import com.todoroo.astrid.service.StatisticsService;
import com.todoroo.astrid.sync.SyncBackgroundService;
import com.todoroo.astrid.sync.SyncContainer;
import com.todoroo.astrid.sync.SyncProvider;
import com.todoroo.astrid.utility.Constants;
@ -55,17 +54,17 @@ import com.todoroo.astrid.utility.Flags;
import com.todoroo.gtasks.GoogleConnectionManager;
import com.todoroo.gtasks.GoogleLoginException;
import com.todoroo.gtasks.GoogleTaskService;
import com.todoroo.gtasks.GoogleTaskService.ConvenientTaskCreator;
import com.todoroo.gtasks.GoogleTaskTask;
import com.todoroo.gtasks.GoogleTaskView;
import com.todoroo.gtasks.GoogleTasksException;
import com.todoroo.gtasks.GoogleTaskService.ConvenientTaskCreator;
import com.todoroo.gtasks.actions.Actions;
import com.todoroo.gtasks.actions.GetTasksAction;
import com.todoroo.gtasks.actions.ListAction;
import com.todoroo.gtasks.actions.ListActions;
import com.todoroo.gtasks.actions.ListCreationAction;
import com.todoroo.gtasks.actions.ListActions.TaskBuilder;
import com.todoroo.gtasks.actions.ListActions.TaskModifier;
import com.todoroo.gtasks.actions.ListCreationAction;
@SuppressWarnings("nls")
public class GtasksSyncProvider extends SyncProvider<GtasksTaskContainer> {
@ -190,7 +189,7 @@ public class GtasksSyncProvider extends SyncProvider<GtasksTaskContainer> {
Intent intent = new Intent(activity, GtasksLoginActivity.class);
activity.startActivityForResult(intent, 0);
} else {
activity.startService(new Intent(SyncBackgroundService.SYNC_ACTION, null,
activity.startService(new Intent(null, null,
activity, GtasksBackgroundService.class));
activity.finish();
}

@ -222,7 +222,7 @@ public class ProducteevLoginActivity extends Activity {
* Perform synchronization
*/
protected void synchronize() {
startService(new Intent(ProducteevBackgroundService.SYNC_ACTION, null,
startService(new Intent(null, null,
this, ProducteevBackgroundService.class));
finish();
}

@ -26,7 +26,7 @@ public class ProducteevSyncActionExposer extends BroadcastReceiver {
if(!ProducteevUtilities.INSTANCE.isLoggedIn())
return;
Intent syncIntent = new Intent(ProducteevBackgroundService.SYNC_ACTION, null,
Intent syncIntent = new Intent(null, null,
context, ProducteevBackgroundService.class);
PendingIntent pendingIntent = PendingIntent.getService(context, 0, syncIntent, PendingIntent.FLAG_UPDATE_CURRENT);
SyncAction syncAction = new SyncAction(context.getString(R.string.producteev_PPr_header),

@ -192,7 +192,7 @@ public class ProducteevSyncProvider extends SyncProvider<ProducteevTaskContainer
Intent intent = new Intent(activity, ProducteevLoginActivity.class);
activity.startActivityForResult(intent, 0);
} else {
activity.startService(new Intent(ProducteevBackgroundService.SYNC_ACTION, null,
activity.startService(new Intent(null, null,
activity, ProducteevBackgroundService.class));
}
}

Loading…
Cancel
Save