/** Starts a full sync. */ public static void startFullSync() { Bundle b = new Bundle(); // Request aggressively that the sync should start straight away. b.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true); b.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true); // Fetch everything, except fetch only newly added observations if so enabled. b.putBoolean(SyncOption.FULL_SYNC.name(), true); LOG.i("Requesting full sync"); ContentResolver.requestSync(getAccount(), Contracts.CONTENT_AUTHORITY, b); }
/** Starts an sync of just the observations. */ public static void startObservationsSync() { // Start by canceling any existing syncs, which may delay this one. ContentResolver.cancelSync(getAccount(), Contracts.CONTENT_AUTHORITY); Bundle b = new Bundle(); // Request aggressively that the sync should start straight away. b.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true); b.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true); // Fetch just the newly added observations. b.putBoolean(SyncPhase.SYNC_OBSERVATIONS.name(), true); b.putBoolean(SyncPhase.SYNC_ORDERS.name(), true); LOG.i("Requesting incremental observation sync"); ContentResolver.requestSync(getAccount(), Contracts.CONTENT_AUTHORITY, b); }
@Override public void onDestroy() { LOG.i("Service destroyed"); }
@Override public void onCreate() { LOG.i("Service created"); mAuthenticator = new Authenticator(this); }