Example usage for android.content Intent ACTION_SYNC

List of usage examples for android.content Intent ACTION_SYNC

Introduction

In this page you can find the example usage for android.content Intent ACTION_SYNC.

Prototype

String ACTION_SYNC

To view the source code for android.content Intent ACTION_SYNC.

Click Source Link

Document

Activity Action: Perform a data synchronization.

Usage

From source file:com.infine.android.devoxx.ui.TwitterActivity.java

private void triggerRefresh() {
    final Uri tweetsUri = ScheduleContract.Tweets.CONTENT_URI;
    final Intent intent = new Intent(Intent.ACTION_SYNC, tweetsUri, this, TwitterService.class);
    startService(intent);// w w  w . ja v  a 2  s . com
}

From source file:cz.maresmar.sfm.view.portal.PluginListLoader.java

/**
 * This is where the bulk of our work is done.  This function is
 * called in a background thread and should generate a new set of
 * data to be published by the loader.//from  w ww .  j a  v  a 2  s.  c  o  m
 */
@Override
public List<PluginInfo> loadInBackground() {
    // Retrieve all known plugins
    Intent intent = new Intent(Intent.ACTION_SYNC);
    intent.addCategory("cz.maresmar.sfm.plugin");
    final List<ResolveInfo> list = mPm.queryIntentServices(intent, 0);
    final List<PluginInfo> packages = new ArrayList<>();
    if (list != null) {
        for (ResolveInfo resolveInfo : list) {
            String pluginLabel = resolveInfo.serviceInfo.loadLabel(mPm).toString();
            String pluginId = resolveInfo.serviceInfo.packageName + PublicProviderContract.PLUGIN_DATA_SEPARATOR
                    + resolveInfo.serviceInfo.name;
            packages.add(new PluginInfo(pluginLabel, pluginId));
        }
    }

    // Done!
    return packages;
}

From source file:org.androidtitlan.estoesgoogle.ui.HomeActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (!EulaHelper.hasAcceptedEula(this)) {
        EulaHelper.showEula(false, this);
    }/*from   w w w. j  a  v a  2 s.c o m*/

    AnalyticsUtils.getInstance(this).trackPageView("/Home");

    setContentView(R.layout.activity_home);
    getActivityHelper().setupActionBar(null, 0);

    FragmentManager fm = getSupportFragmentManager();

    mTagStreamFragment = (TagStreamFragment) fm.findFragmentById(R.id.fragment_tag_stream);

    mSyncStatusUpdaterFragment = (SyncStatusUpdaterFragment) fm
            .findFragmentByTag(SyncStatusUpdaterFragment.TAG);
    if (mSyncStatusUpdaterFragment == null) {
        mSyncStatusUpdaterFragment = new SyncStatusUpdaterFragment();
        fm.beginTransaction().add(mSyncStatusUpdaterFragment, SyncStatusUpdaterFragment.TAG).commit();
    }

    if (!EulaHelper.didSync(this)) {
        final Intent intent = new Intent(Intent.ACTION_SYNC, null, this, SyncService.class);
        intent.putExtra(SyncService.EXTRA_STATUS_RECEIVER, mSyncStatusUpdaterFragment.mReceiver);
        startService(intent);

        if (mTagStreamFragment != null) {
            mTagStreamFragment.refresh();
        }
        EulaHelper.setSync(this);
    }
}

From source file:org.xbmc.android.remotesandbox.ui.MusicPagerActivity.java

private void triggerRefresh() {
    final long start = System.currentTimeMillis();
    Log.d(TAG, "Starting triggerRefresh()...");

    final Intent intent = new Intent(Intent.ACTION_SYNC, null, this, AudioSyncService.class);
    intent.putExtra(AudioSyncService.EXTRA_STATUS_RECEIVER, mSyncStatusUpdaterFragment.mReceiver);
    startService(intent);/* w  w w . ja v  a 2  s.c  o m*/

    /*      if (mTagStreamFragment != null) {
             mTagStreamFragment.refresh();
          }*/
    Log.d(TAG, "triggerRefresh() done in " + (System.currentTimeMillis() - start) + "ms.");
}

From source file:com.google.android.apps.iosched.ui.HomeActivity.java

private void triggerRefresh() {
    final Intent intent = new Intent(Intent.ACTION_SYNC, null, this, SyncService.class);
    intent.putExtra(SyncService.EXTRA_STATUS_RECEIVER, mSyncStatusUpdaterFragment.mReceiver);
    startService(intent);/*from   w  ww.  ja v a2 s  .  c  om*/

    if (mTagStreamFragment != null) {
        mTagStreamFragment.refresh();
    }
}

From source file:net.peterkuterna.android.apps.devoxxsched.service.NewsSyncService.java

@Override
protected void doSync(Intent intent) throws Exception {
    Log.d(TAG, "Start news sync");

    final Context context = this;

    final SharedPreferences settings = Prefs.get(context);
    final int localVersion = settings.getInt(DevoxxPrefs.NEWS_LOCAL_VERSION, VERSION_NONE);

    final long startLocal = System.currentTimeMillis();
    final boolean localParse = localVersion < VERSION_CURRENT;
    Log.d(TAG, "found localVersion=" + localVersion + " and VERSION_CURRENT=" + VERSION_CURRENT);
    if (localParse) {
        mLocalExecutor.execute(context, "cache-news.json", new NewsHandler());

        // Save local parsed version
        settings.edit().putInt(DevoxxPrefs.NEWS_LOCAL_VERSION, VERSION_CURRENT).commit();

        final ContentValues values = new ContentValues();
        values.put(News.NEWS_NEW, 0);//from w  w w . j a va  2s  .c o  m
        getContentResolver().update(News.CONTENT_NEW_URI, values, null, null);
    }
    Log.d(TAG, "Local sync took " + (System.currentTimeMillis() - startLocal) + "ms");

    final CfpSyncManager syncManager = new CfpSyncManager(context);
    if (syncManager.shouldPerformRemoteSync(Intent.ACTION_SYNC.equals(intent.getAction()))) {
        Log.d(TAG, "Should perform remote sync");
        final long startRemote = System.currentTimeMillis();
        mRemoteExecutor.executeGet(NEWS_URL, new NewsHandler());
        Log.d(TAG, "Remote sync took " + (System.currentTimeMillis() - startRemote) + "ms");
    } else {
        Log.d(TAG, "Should not perform remote sync");
    }

    final NotifierManager notifierManager = new NotifierManager(this);
    notifierManager.notifyNewNewsItems();

    Log.d(TAG, "News sync finished");
}

From source file:org.dalmasso.ietfsched.ui.HomeActivity.java

private void triggerRefresh() {

    final Intent intent = new Intent(Intent.ACTION_SYNC, null, this, SyncService.class);
    intent.putExtra(SyncService.EXTRA_STATUS_RECEIVER, mSyncStatusUpdaterFragment.mReceiver);
    Log.d(TAG, "Start Sync service");
    startService(intent);//w  w  w.  j  a  v  a2 s  .com

    /*        if (mTagStreamFragment != null) {
    mTagStreamFragment.refresh();
            }
    */
}

From source file:tw.idv.gasolin.pycontw2012.ui.HomeActivity.java

private void triggerRefresh() {
    final Intent intent = new Intent(Intent.ACTION_SYNC, null, this, SyncService.class);

    Log.d(TAG, "triggerRefresh: " + mSyncStatusUpdaterFragment.mReceiver);

    intent.putExtra(SyncService.EXTRA_STATUS_RECEIVER, mSyncStatusUpdaterFragment.mReceiver);
    startService(intent);// ww  w.ja v  a2s  .c om

    if (mTagStreamFragment != null) {
        mTagStreamFragment.refresh();
    }
}

From source file:com.google.android.apps.iosched2.ui.SetupActivity.java

private void checkSetup() {

    if (SetupHelper.hasChosenSetup(this)) {

        mDialog = ProgressDialog.show(SetupActivity.this, "", getText(R.string.title_loading), true);

        final Intent intent = new Intent(Intent.ACTION_SYNC, null, this, SyncService.class);
        intent.putExtra(SyncService.EXTRA_STATUS_RECEIVER, mReceiver);
        startService(intent);/*from w ww  . ja v a2  s  .  c  o  m*/

    }
}

From source file:com.heneryh.aquanotes.ui.HomeActivity.java

private void triggerRefresh() {
    final Intent intent = new Intent(Intent.ACTION_SYNC, null, this, SyncService.class);
    //      intent.putExtra(SyncService.EXTRA_STATUS_RECEIVER, mSyncStatusUpdaterFragment.mReceiver);
    startService(intent);/*w w  w.  j  av a2s  .c o m*/
}