示例#1
0
  /** 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);
  }
示例#2
0
  /** 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);
  }
示例#3
0
 @Override
 public void onDestroy() {
   LOG.i("Service destroyed");
 }
示例#4
0
 @Override
 public void onCreate() {
   LOG.i("Service created");
   mAuthenticator = new Authenticator(this);
 }