List of usage examples for android.content ContentResolver isSyncActive
public static boolean isSyncActive(Account account, String authority)
From source file:com.google.samples.apps.iosched.ui.BaseActivity.java
protected void requestDataRefresh() { Account activeAccount = AccountUtils.getActiveAccount(this); ContentResolver contentResolver = getContentResolver(); if (contentResolver.isSyncActive(activeAccount, ScheduleContract.CONTENT_AUTHORITY)) { LOGD(TAG, "Ignoring manual sync request because a sync is already in progress."); return;/*from w ww . j av a 2 s. co m*/ } mManualSyncRequest = true; LOGD(TAG, "Requesting manual data refresh."); SyncHelper.requestManualSync(activeAccount); }
From source file:com.razza.apps.iosched.ui.BaseActivity.java
protected void requestDataRefresh() { Account activeAccount = AccountUtils.getActiveAccount(this); ContentResolver contentResolver = getContentResolver(); if (contentResolver.isSyncActive(activeAccount, ScheduleContract.CONTENT_AUTHORITY)) { LogUtils.LOGD(TAG, "Ignoring manual sync request because a sync is already in progress."); return;/*www. ja v a 2 s . c o m*/ } mManualSyncRequest = true; LogUtils.LOGD(TAG, "Requesting manual data refresh."); SyncHelper.requestManualSync(activeAccount); }
From source file:com.ntsync.android.sync.shared.SyncUtils.java
/** * Check if a Sync is active//from w w w . j a v a 2s .c om * * @param accountName * @return true if a Sync is active with the current Account Name */ public static boolean isSyncActive(String accountName) { Account account = new Account(accountName, Constants.ACCOUNT_TYPE); return ContentResolver.isSyncActive(account, ContactsContract.AUTHORITY); }
From source file:com.elegion.newsfeed.fragment.SwipeToRefreshList.java
@Override public final void onStatusChanged(int which) { mRefresher.post(new Runnable() { @Override/*from w w w. j av a 2 s .c om*/ public void run() { onSyncStatusChanged(AppDelegate.sAccount, ContentResolver.isSyncActive(AppDelegate.sAccount, AppDelegate.AUTHORITY)); } }); }
From source file:me.philio.ghost.ui.MainActivity.java
@Override public void onSwipeRefreshCreated(SwipeRefreshLayout layout) { mSwipeRefreshLayout = layout;// w w w.jav a 2 s . c o m if (ContentResolver.isSyncActive(mNavigationDrawerFragment.getSelectedAccount(), getString(R.string.content_authority))) { mSwipeRefreshLayout.setRefreshing(true); } }
From source file:dev.drsoran.moloko.sync.util.SyncUtils.java
public final static boolean isSyncing(Context context) { final Account account = AccountUtils.getRtmAccount(context); return account != null && !ContentResolver.isSyncPending(account, Rtm.AUTHORITY) && ContentResolver.isSyncActive(account, Rtm.AUTHORITY); }
From source file:org.kontalk.sync.SyncAdapter.java
public static boolean isActive(Context context) { Account acc = Authenticator.getDefaultAccount(context); return acc != null && ContentResolver.isSyncActive(acc, ContactsContract.AUTHORITY); }
From source file:edu.mit.mobile.android.locast.ver2.browser.BrowserHome.java
@Override protected void onResume() { super.onResume(); mSyncHandle = ContentResolver.addStatusChangeListener(0xff, new SyncStatusObserver() { @Override/* ww w.j av a 2s .c o m*/ public void onStatusChanged(int which) { Account a = Authenticator.getFirstAccount(BrowserHome.this); if (!ContentResolver.isSyncActive(a, MediaProvider.AUTHORITY) && !ContentResolver.isSyncPending(a, MediaProvider.AUTHORITY)) { Log.d(TAG, "Sync finished, should refresh naw!!"); mHandler.sendEmptyMessage(MSG_SET_NOT_REFRESHING); } else { Log.d(TAG, "Sync Active or Pending!!"); mHandler.sendEmptyMessage(MSG_SET_REFRESHING); } } }); //check if synch is in progress Account a = Authenticator.getFirstAccount(BrowserHome.this); if (!ContentResolver.isSyncActive(a, MediaProvider.AUTHORITY) && !ContentResolver.isSyncPending(a, MediaProvider.AUTHORITY)) { Log.d(TAG, "Sync finished, should refresh naw!!"); mHandler.sendEmptyMessage(MSG_SET_NOT_REFRESHING); } else { Log.d(TAG, "Sync Active or Pending!!"); mHandler.sendEmptyMessage(MSG_SET_REFRESHING); } if (shouldRefresh) { refresh(false); } }
From source file:edu.mit.mobile.android.locast.ver2.itineraries.ItineraryList.java
@Override protected void onResume() { super.onResume(); mSyncWhenLoaded = true;/* ww w . jav a2s .c o m*/ mSyncHandle = ContentResolver.addStatusChangeListener(0xff, new SyncStatusObserver() { @Override public void onStatusChanged(int which) { Account a = Authenticator.getFirstAccount(ItineraryList.this); if (!ContentResolver.isSyncActive(a, MediaProvider.AUTHORITY) && !ContentResolver.isSyncPending(a, MediaProvider.AUTHORITY)) { Log.d(TAG, "Sync finished, should refresh naw!!"); mHandler.sendEmptyMessage(MSG_SET_NOT_REFRESHING); } else { Log.d(TAG, "Sync Active or Pending!!"); mHandler.sendEmptyMessage(MSG_SET_REFRESHING); } } }); //check if synch is in progress Account a = Authenticator.getFirstAccount(ItineraryList.this); if (!ContentResolver.isSyncActive(a, MediaProvider.AUTHORITY) && !ContentResolver.isSyncPending(a, MediaProvider.AUTHORITY)) { Log.d(TAG, "Sync finished, should refresh naw!!"); mHandler.sendEmptyMessage(MSG_SET_NOT_REFRESHING); } else { Log.d(TAG, "Sync Active or Pending!!"); mHandler.sendEmptyMessage(MSG_SET_REFRESHING); } }
From source file:org.ohmage.fragments.HomeFragment.java
public void checkSyncStatus() { Account[] accounts = am.getAccountsByType(AuthUtil.ACCOUNT_TYPE); if (accounts.length == 0) { return;/*from w w w . ja va 2 s . co m*/ } mHandler.removeCallbacks(mRefreshCompleteRunnable); if (ContentResolver.isSyncActive(accounts[0], OhmageContract.CONTENT_AUTHORITY) || ContentResolver.isSyncPending(accounts[0], OhmageContract.CONTENT_AUTHORITY)) { getActivity().runOnUiThread(new Runnable() { @Override public void run() { if (getListAdapter() == null || getListAdapter().isEmpty()) { mPullToRefreshLayout.setRefreshing(true); setEmptyText("Please wait for Surveys to Synchronize..."); } } }); } else { mHandler.postDelayed(mRefreshCompleteRunnable, 500); } }