Example usage for android.content ContentResolver SYNC_EXTRAS_EXPEDITED

List of usage examples for android.content ContentResolver SYNC_EXTRAS_EXPEDITED

Introduction

In this page you can find the example usage for android.content ContentResolver SYNC_EXTRAS_EXPEDITED.

Prototype

String SYNC_EXTRAS_EXPEDITED

To view the source code for android.content ContentResolver SYNC_EXTRAS_EXPEDITED.

Click Source Link

Document

If this extra is set to true, the sync request will be scheduled at the front of the sync request queue and without any delay

Usage

From source file:org.sufficientlysecure.keychain.service.ContactSyncAdapterService.java

public static void requestContactsSync() {
    // if user has disabled automatic sync, do nothing
    boolean isSyncEnabled = ContentResolver.getSyncAutomatically(
            new Account(Constants.ACCOUNT_NAME, Constants.ACCOUNT_TYPE), ContactsContract.AUTHORITY);

    if (!isSyncEnabled) {
        return;/*ww w .j av  a 2  s  .c o m*/
    }

    Bundle extras = new Bundle();
    // no need to wait, do it immediately
    extras.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);
    extras.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true);
    ContentResolver.requestSync(new Account(Constants.ACCOUNT_NAME, Constants.ACCOUNT_TYPE),
            ContactsContract.AUTHORITY, extras);
}

From source file:p1.nd.khan.jubair.mohammadd.popularmovies.sync.MovieSyncAdapter.java

/**
 * Helper method to have the sync adapter immediately
 *
 * @param context  The context used to access the account service
 *//*w  w w  .ja v a2s .c  o m*/
public static void syncImmediately(Context context) {
    Log.v("LOG_TAG", "===[called syncImmediately ]: ");
    Bundle bundle = new Bundle();
    bundle.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true);
    bundle.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);
    ContentResolver.requestSync(getSyncAccount(context), context.getString(R.string.content_authority), bundle);
}

From source file:p1.nd.khan.jubair.mohammadd.popularmovies.sync.MovieSyncAdapter.java

/**
 * Helper method to have the sync adapter immediately
 *
 * @param context The context used to access the account service
 * @param movieId The Movie to be sync//w w w . ja v  a  2s .co  m
 */
public static void syncMovieDetails(Context context, String movieId) {
    Bundle bundle = new Bundle();
    bundle.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true);
    bundle.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);
    if (null != movieId) {
        bundle.putString(Constants.DETAIL_SYNC_MOVIE_ID, movieId);
    }
    ContentResolver.requestSync(getSyncAccount(context), context.getString(R.string.content_authority), bundle);
}

From source file:uk.co.bubblebearapps.contactsintegration.MainActivity.java

private void syncAccount(Account account) {

    // Pass the settings flags by inserting them in a bundle
    Bundle settingsBundle = new Bundle();
    settingsBundle.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);
    settingsBundle.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true);
    /*//from   www  .j  av a  2 s  .com
     * Request the sync for the default account, authority, and
     * manual sync settings
     */
    ContentResolver.requestSync(account, ContactsContract.AUTHORITY, settingsBundle);

    showMessage("Sync requested, view results in Contacts app");

}

From source file:com.hybris.mobile.app.commerce.CommerceApplicationBase.java

/**
 * Request a sync of the catalog sync adapter
 *
 * @param bundle/*  w ww  .ja v a 2  s.  c  o m*/
 */
public static void requestCatalogSyncAdapter(Bundle bundle) {
    bundle.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);
    bundle.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true);
    ContentResolver.requestSync(
            new Account(mInstance.getString(R.string.account_name), mInstance.getString(R.string.account_type)),
            mInstance.getString(R.string.provider_authority), bundle);
}

From source file:com.beesham.popularmovies.sync.MoviesSyncAdapter.java

public static void syncImmediately(Context context) {
    Bundle b = new Bundle();
    b.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true);
    b.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);

    ContentResolver.requestSync(getSyncAccount(context), context.getString(R.string.content_authority), b);
}

From source file:org.enbyted.android.zseinfo.view.activity.MainActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    BaseSection currentSection = pagerAdapter.getSection(getSupportActionBar().getSelectedTab().getPosition());
    switch (item.getItemId()) {
    case R.id.action_refresh: {
        if (currentSection.isRefreshActive()) {
            currentSection.onRefreshPressed();
        }/*ww  w . j a  v a  2s . c o  m*/
        break;
    }
    case android.R.id.home: {
        if (currentSection.isBackActive()) {
            currentSection.onBackPressed();
        }
        break;
    }
    case R.id.action_settings: {
        Intent intent = new Intent(this, SettingsActivity.class);
        startActivity(intent);
        break;
    }
    case R.id.action_about: {
        Intent intent = new Intent(this, AboutActivity.class);
        startActivity(intent);
        break;
    }
    case R.id.action_synchronise: {
        Toast.makeText(this, "Rozpoczynanie synchronizacji.", Toast.LENGTH_LONG).show();

        Bundle extras = new Bundle();
        extras.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true);
        extras.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);
        extras.putBoolean("config", true);
        extras.putBoolean("replacements", true);
        extras.putBoolean("timetables", true);

        ContentResolver.requestSync(account, AUTHORITY, extras);
        break;
    }
    }

    return false;
}

From source file:com.gaba.alex.trafficincidents.MainActivity.java

private void refresh() {
    Bundle settingsBundle = new Bundle();
    settingsBundle.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);
    settingsBundle.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true);
    ContentResolver.requestSync(mAccount, AUTHORITY, settingsBundle);
}

From source file:com.jasonmheim.rollout.station.CoreContentProvider.java

@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {

    StationDataCursor cursor = new StationDataCursor();
    if (stationList == null) {
        Log.i("Rollout", "Provider not yet initialized, checking local storage...");
        stationList = stationDataStorage.get();
    }/*w ww .  j  a va 2s .  co m*/
    if (stationList == null) {
        Log.i("Rollout", "Local storage was empty.");
        Future<StationList> future = executorService.submit(stationListDownloader);
        try {
            StationList providerList = future.get();
            if (providerList == null) {
                Log.i("Rollout", "Station list failed to download from query, requesting sync");
                Bundle settingsBundle = new Bundle();
                settingsBundle.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);
                settingsBundle.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true);
                ContentResolver.requestSync(ACCOUNT, AUTHORITY, settingsBundle);
            } else {
                Log.i("Rollout", "Direct download succeeded.");
                // This implicitly sets stationList
                internalInsert(providerList);
            }
        } catch (InterruptedException ex) {
            Log.w("Rollout", "Content provider sync was interrupted", ex);
        } catch (ExecutionException ex) {
            Log.w("Rollout", "Content provider sync execution failed", ex);
        }
    }
    if (stationList != null) {
        cursor.setStationDataJson(gson.toJson(stationList));
    }
    cursor.setNotificationUri(getContext().getContentResolver(), Constants.STATION_URI);
    return cursor;
}

From source file:edu.mit.mobile.android.locast.itineraries.ItineraryDetail.java

private void refresh(boolean explicitSync) {
    final Bundle extras = new Bundle();
    if (mItineraryCastCount == UNKNOWN_COUNT || (mItineraryCastCount != mCastAdapter.getCount())) {
        extras.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true);
    }// ww w  .  j  av  a  2 s.co  m

    final Bundle extras2 = new Bundle();
    // we always deprioritize this so that the casts will take priority.
    extras2.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, false);
    LocastSync.startSync(this, mUri, explicitSync, extras2);
    LocastSync.startSync(this, mCastsUri, explicitSync, extras);

}