Search in sources :

Example 1 with SyncHelper

use of com.google.samples.apps.iosched.sync.SyncHelper in project iosched by google.

the class ForceSyncNowAction method run.

@Override
public void run(final Context context, final Callback callback) {
    ConferenceDataHandler.resetDataTimestamp(context);
    final Bundle bundle = new Bundle();
    bundle.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);
    new AsyncTask<Context, Void, Void>() {

        @Override
        protected Void doInBackground(Context... contexts) {
            Account account = AccountUtils.getActiveAccount(context);
            if (account == null) {
                callback.done(false, "Cannot sync if there is no active account.");
            } else {
                new SyncHelper(contexts[0]).performSync(new SyncResult(), bundle);
            }
            return null;
        }
    }.execute(context);
}
Also used : Context(android.content.Context) Account(android.accounts.Account) Bundle(android.os.Bundle) SyncHelper(com.google.samples.apps.iosched.sync.SyncHelper) SyncResult(android.content.SyncResult)

Aggregations

Account (android.accounts.Account)1 Context (android.content.Context)1 SyncResult (android.content.SyncResult)1 Bundle (android.os.Bundle)1 SyncHelper (com.google.samples.apps.iosched.sync.SyncHelper)1