List of usage examples for android.content ContentResolver SYNC_EXTRAS_EXPEDITED
String SYNC_EXTRAS_EXPEDITED
To view the source code for android.content ContentResolver SYNC_EXTRAS_EXPEDITED.
Click Source Link
From source file:p1.nd.khan.jubair.mohammadd.popularmovies.sync.MovieSyncAdapter.java
/** * Method to load more data based on scrolling. * * @param context The context used to load more movie. * @param offset page number to request/load the data. */// w w w . ja v a 2 s. c o m public static void loadMoreData(Context context, int offset) { //Log.v("LOG_TAG","loadMoreData:"+offset); Bundle bundle = new Bundle(); bundle.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true); bundle.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true); bundle.putInt("page", offset); ContentResolver.requestSync(getSyncAccount(context), context.getString(R.string.content_authority), bundle); }
From source file:org.gots.ui.BaseGotsActivity.java
protected void onRefresh(String AUTHORITY) { if (AUTHORITY == null || "".equals(AUTHORITY)) { Log.d(TAG, "You call onRefresh without Content Resolver Authority"); return;/*from w w w .ja v a2 s . co m*/ } Account userAccount = gotsPrefs.getUserAccount(); ContentResolver.setSyncAutomatically(userAccount, AUTHORITY, true); Bundle bundle = new Bundle(); bundle.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true); bundle.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true); ContentResolver.requestSync(userAccount, AUTHORITY, bundle); }
From source file:de.stkl.gbgvertretungsplan.fragments.MainFragment.java
public void actionRefresh() { // only if neither pending nor active if (!ContentResolver.isSyncActive(((MainActivity) getActivity()).mDefaultAccount, getString(Account.CONTENT_AUTHORITY)) && !ContentResolver.isSyncPending(((MainActivity) getActivity()).mDefaultAccount, getString(Account.CONTENT_AUTHORITY))) { Bundle settingsBundle = new Bundle(); settingsBundle.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true); // this is a manual sync settingsBundle.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true); // start immediately ContentResolver.requestSync(Authenticator.getDefaultAccount(getActivity()), getString(Account.CONTENT_AUTHORITY), settingsBundle); }// w ww.jav a 2s . c om }
From source file:com.sintef_energy.ubisolar.activities.DrawerActivity.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); Session.getActiveSession().onActivityResult(this, requestCode, resultCode, data); if (requestCode == LOGIN_CALL_ID) { if (resultCode == Activity.RESULT_OK) { Log.v(TAG, "Login was successful. Starting to attain session data."); startFacebookLogin(null);/* w w w. ja va2 s.co m*/ // Find the account Account[] accounts = getAccounts(getApplicationContext(), ACCOUNT_TYPE); for (Account account : accounts) { if (account.name.equals(data.getStringExtra(AccountManager.KEY_ACCOUNT_NAME))) { mAccount = account; break; } } if (mAccount == null) { Log.e(TAG, "Account creation somehow failed to make an account."); return; } /* The same as ticking allow sync */ ContentResolver.setSyncAutomatically(mAccount, AUTHORITY_PROVIDER, true); /* Request a sync operation */ Bundle bundle = new Bundle(); bundle.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true); //Do sync regardless of settings bundle.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true); //Force sync immediately ContentResolver.requestSync(mAccount, AUTHORITY_PROVIDER, bundle); /* Update all -1 users to the current user id. */ AccountManager accountManager = (AccountManager) getApplicationContext() .getSystemService(ACCOUNT_SERVICE); String facebookUID = accountManager.getUserData(mAccount, Global.DATA_FB_UID); ContentValues values = new ContentValues(); values.put(DeviceModel.DeviceEntry.COLUMN_USER_ID, facebookUID); values.put(DeviceModel.DeviceEntry.COLUMN_LAST_UPDATED, System.currentTimeMillis() / 1000L); getContentResolver().update(EnergyContract.Devices.CONTENT_URI, values, EnergyContract.Devices.COLUMN_USER_ID + "=?", new String[] { "-1" }); //Publish a post saying you started using Wattitude RequestManager.getInstance().doFriendRequest().createWallPost( new NewsFeedPost(0, Long.valueOf(facebookUID), 1, System.currentTimeMillis() / 1000), null); } else { Log.v(TAG, "Login failed"); } } }
From source file:com.creationgroundmedia.popularmovies.sync.MovieSyncAdapter.java
public static void syncImmediately(Context context) { 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:com.odoo.MainActivity.java
/** * Request sync./*from www .j a va 2 s . c o m*/ * * @param authority * the authority * @param bundle * the extra data */ public void requestSync(String authority, Bundle bundle) { Account account = OdooAccountManager.getAccount(getApplicationContext(), OUser.current(getApplicationContext()).getAndroidName()); Bundle settingsBundle = new Bundle(); settingsBundle.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true); settingsBundle.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true); if (bundle != null) { settingsBundle.putAll(bundle); } ContentResolver.requestSync(account, authority, settingsBundle); }
From source file:org.ohmage.app.SurveyActivity.java
public synchronized void submit() { isFinished = true;/*w w w . j a va 2 s.c o m*/ // Tell reminders that the survey was taken TriggerFramework.notifySurveyTaken(this, Surveys.getId(getIntent().getData())); ContentValues values = new ContentValues(); values.put(Responses.SURVEY_ID, Surveys.getId(getIntent().getData())); values.put(Responses.SURVEY_VERSION, Surveys.getVersion(getIntent().getData())); if (mLocationClient != null && mLocationClient.isConnected()) { values.put(Responses.RESPONSE_METADATA, new StreamPointBuilder().now().withId() .withLocation(mLocationClient.getLastLocation()).getMetadata()); } else { values.put(Responses.RESPONSE_METADATA, new StreamPointBuilder().now().withId().getMetadata()); } mPagerAdapter.buildResponse(values); getContentResolver().insert(Responses.CONTENT_URI, values); Toast.makeText(this, "The response has been submitted. Thank you!", Toast.LENGTH_SHORT).show(); AppLogManager.getInstance().logInfo(this, "SurveySubmitted", "User submitted the survey: " + Surveys.getId(getIntent().getData())); // Force a sync to upload data Bundle settingsBundle = new Bundle(); settingsBundle.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true); settingsBundle.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true); Account[] accounts = am.getAccountsByType(AuthUtil.ACCOUNT_TYPE); if (accounts.length == 1) { Account account = accounts[0]; getContentResolver().requestSync(account, ResponseContract.CONTENT_AUTHORITY, settingsBundle); getContentResolver().requestSync(account, AppLogSyncAdapter.CONTENT_AUTHORITY, settingsBundle); } finish(); }
From source file:edu.mit.mobile.android.locast.ver2.itineraries.ItineraryDetail.java
private void refresh(boolean explicitSync) { LocastSyncService.startSync(this, mUri, explicitSync); final Bundle extras = new Bundle(); if (mItineraryCastCount == UNKNOWN_COUNT || (mItineraryCastCount != mCastAdapter.getCount())) { extras.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true); }/*from ww w .ja v a 2 s . co m*/ LocastSyncService.startSync(this, mCastsUri, explicitSync, extras); }
From source file:com.google.android.media.tv.companionlibrary.EpgSyncJobService.java
/** * Manually requests a job to run now./*from ww w . j a v a 2 s. c om*/ * * To check the current status of the sync, register a {@link android.content.BroadcastReceiver} * with an {@link android.content.IntentFilter} which checks for the action * {@link #ACTION_SYNC_STATUS_CHANGED}. * <p /> * The sync status is an extra parameter in the {@link Intent} with key * {@link #SYNC_STATUS}. The sync status is either {@link #SYNC_STARTED} or * {@link #SYNC_FINISHED}. * <p /> * Check that the value of {@link #BUNDLE_KEY_INPUT_ID} matches your * {@link android.media.tv.TvInputService}. If you're calling this from your setup activity, * you can get the extra parameter {@link TvInputInfo#EXTRA_INPUT_ID}. * <p /> * @param context Application's context. * @param inputId Component name for the app's TvInputService. This can be received through an * Intent extra parameter {@link TvInputInfo#EXTRA_INPUT_ID}. * @param syncDuration The duration of EPG content to fetch in milliseconds. For a manual sync, * this should be relatively short. For a background sync this should be long. * @param jobServiceComponent The {@link EpgSyncJobService} class that will run. */ public static void requestImmediateSync(Context context, String inputId, long syncDuration, ComponentName jobServiceComponent) { if (jobServiceComponent.getClass().isAssignableFrom(EpgSyncJobService.class)) { throw new IllegalArgumentException("This class does not extend EpgSyncJobService"); } PersistableBundle persistableBundle = new PersistableBundle(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) { persistableBundle.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true); persistableBundle.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true); } persistableBundle.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true); persistableBundle.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true); persistableBundle.putString(EpgSyncJobService.BUNDLE_KEY_INPUT_ID, inputId); persistableBundle.putLong(EpgSyncJobService.BUNDLE_KEY_SYNC_PERIOD, syncDuration); JobInfo.Builder builder = new JobInfo.Builder(REQUEST_SYNC_JOB_ID, jobServiceComponent); JobInfo jobInfo = builder.setExtras(persistableBundle) .setOverrideDeadline(EpgSyncJobService.OVERRIDE_DEADLINE_MILLIS) .setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY).build(); scheduleJob(context, jobInfo); if (DEBUG) { Log.d(TAG, "Single job scheduled"); } }
From source file:com.nextgis.mobile.fragment.LayersFragment.java
@Override public void onClick(View v) { switch (v.getId()) { case R.id.sync: for (Account account : mAccounts) { Bundle settingsBundle = new Bundle(); settingsBundle.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true); settingsBundle.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true); ContentResolver.requestSync(account, AUTHORITY, settingsBundle); }// ww w. ja v a2s . c om updateInfo(); break; case R.id.new_layer: mNewLayer.showContextMenu(); break; } }