项目:react-native-sync-adapter
文件:SyncAdapter.java
/**
* Based on https://gist.github.com/udacityandroid/7230489fb8cb3f46afee
*/
private static void configurePeriodicSync(Context context,int syncInterval,int flexTime) {
Account account = getSyncAccount(context,syncInterval,flexTime);
String authority = context.getString(R.string.rnsb_content_authority);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
// We can enable inexact timers in our periodic sync (better for batter life)
SyncRequest request = new SyncRequest.Builder().
syncPeriodic(syncInterval,flexTime).
setSyncAdapter(account,authority).
setExtras(new Bundle()).build();
ContentResolver.requestSync(request);
} else {
ContentResolver.addPeriodicSync(account,authority,new Bundle(),syncInterval);
}
}
/**
* Helper method to schedule the sync adapter periodic execution
*/
public static void configurePeriodicSync(Context context,int flexTime) {
Account account = getSyncAccount(context);
String authority = context.getString(R.string.content_authority);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
// we can enable inexact timers in our periodic sync
SyncRequest request = new SyncRequest.Builder().
syncPeriodic(syncInterval,syncInterval);
}
}
项目:TVGuide
文件:TvGuideSyncAdapter.java
/**
* Helper method to schedule the sync adapter periodic execution
*/
public static void configurePeriodicSync(Context context,long syncInterval,long flexTime) {
Account account = getSyncAccount(context);
String authority = context.getString(R.string.content_authority);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
// we can enable inexact timers in our periodic sync
SyncRequest request = new SyncRequest.Builder().
syncPeriodic(syncInterval,syncInterval);
}
}
/**
* Helper method to schedule the sync adapter periodic execution
*/
public static void configurePeriodicSync(Context context,syncInterval);
}
}
/**
* Helper method to schedule the sync adapter periodic execution
*/
public static void configurePeriodicSync(Context context,syncInterval);
}
}
/**
* Helper method to schedule the sync adapter periodic execution
*/
public static void configurePeriodicSync(Context context,syncInterval);
}
}
项目:udacity-p3
文件:FootballSyncAdapter.java
/**
* Helper method to schedule the sync adapter periodic execution
*/
public static void configurePeriodicSync(Context context,int flexTime) {
Account account = getSyncAccount(context);
String authority = context.getString(R.string.contentauthority);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
// we can enable inexact timers in our periodic sync
SyncRequest request = new SyncRequest.Builder().
syncPeriodic(syncInterval,syncInterval);
}
}
/**
* Helper method to schedule the sync adapter periodic execution
*/
public static void configurePeriodicSync(Context context,syncInterval);
}
}
项目:Weather4U
文件:Weather4USyncAdapter.java
/**
* Helper method to schedule the sync adapter periodic execution
*/
public static void configurePeriodicSync(Context context,syncInterval);
}
}
/**
* Helper method to schedule the sync adapter periodic execution
*/
public static void configurePeriodicSync(Context context,syncInterval);
}
}
/**
* Helper method to schedule the sync adapter periodic execution
*/
public static void configurePeriodicSync(Context context,int flexTime) {
Account account = getSyncAccount(context);
String authority = context.getString(R.string.sync_provider_authority);
if (syncInterval == -1) {
ContentResolver.setSyncAutomatically(account,context.getString(R.string.sync_provider_authority),false);
} else {
ContentResolver.setSyncAutomatically(account,true);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
// we can enable inexact timers in our periodic sync
SyncRequest request = new SyncRequest.Builder().
syncPeriodic(syncInterval,flexTime).
setSyncAdapter(account,authority).
setExtras(new Bundle()).build();
ContentResolver.requestSync(request);
} else {
ContentResolver.addPeriodicSync(account,syncInterval);
}
}
}
/**
* Helper method to schedule the sync adapter periodic execution
*/
public static void configurePeriodicSync(Context context,syncInterval);
}
}
/**
* Helper method to schedule the sync adapter periodic execution
*/
public static void configurePeriodicSync(Context context,syncInterval);
}
}
/**
* Helper method to schedule the sync adapter periodic execution
*/
public static void configurePeriodicSync(Context context,syncInterval);
}
}
项目:DBUFR
文件:DbufrSyncAdapter.java
private static void configurePeriodicSync(Context context,int syncFlextime) {
Account account = getSyncAccount(context);
String authority = context.getString(R.string.content_authority);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
// we can enable inexact timers in our periodic sync
try {
SyncRequest request = new SyncRequest.Builder().
syncPeriodic(syncInterval,syncFlextime).
setSyncAdapter(account,authority).build();
ContentResolver.requestSync(request);
} catch (Exception e) {
}
} else {
ContentResolver.addPeriodicSync(account,syncInterval);
}
}
项目:Filmy
文件:FilmySyncAdapter.java
/**
* Helper method to schedule the sync adapter periodic execution
*/
public static void configurePeriodicSync(Context context,int flexTime) {
Account account = getSyncAccount(context);
String authority = context.getString(R.string.content_authority);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
// we can enable inexact timers in our periodic sync
SyncRequest request = new SyncRequest.Builder().
syncPeriodic(syncInterval,syncInterval);
}
}
/**
* Helper method to schedule the sync adapter periodic execution
*/
public static void configurePeriodicSync(Context context,syncInterval);
}
}
/**
* Helper method to schedule the sync adapter periodic execution
*/
public static void configurePeriodicSync(Context context,syncInterval);
}
}
/**
* Helper method to schedule the sync adapter periodic execution
*/
public static void configurePeriodicSync(Context context,syncInterval);
}
}
/**
* Helper method to schedule the sync adapter periodic execution
*/
public static void configurePeriodicSync(Context context,syncInterval);
}
}
/**
* Helper method to schedule the sync adapter periodic execution
*/
public static void configurePeriodicSync(Context context,syncInterval);
}
}
/**
* Helper method to schedule the sync adapter periodic execution
*/
public static void configurePeriodicSync(Context context,syncInterval);
}
}
/**
* Helper method to schedule the sync adapter periodic execution
*/
public static void configurePeriodicSync(Context context,syncInterval);
}
}
项目:Woodmin
文件:WoodminSyncAdapter.java
public static void configurePeriodicSync(Context context,int flexTime) {
Account account = getSyncAccount(context);
String authority = context.getString(R.string.content_authority);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
// we can enable inexact timers in our periodic sync
SyncRequest request = new SyncRequest.Builder()
.syncPeriodic(syncInterval,flexTime)
.setSyncAdapter(account,authority)
.setExtras(new Bundle())
.build();
ContentResolver.requestSync(request);
ContentResolver.addPeriodicSync(account,syncInterval);
} else {
ContentResolver.addPeriodicSync(account,syncInterval);
}
}
/**
* Helper method to schedule the sync adapter periodic execution
*/
public static void configurePeriodicSync(Context context,syncInterval);
}
}
项目:spst
文件:spotifystreamerSyncAdapter.java
/**
* Helper method to schedule the sync adapter periodic execution
*/
public static void configurePeriodicSync(Context context,authority).
setExtras(new Bundle()).build();
ContentResolver.requestSync(request);
} else {
ContentResolver.addPeriodicSync(account,syncInterval);
}
}
/**
* Helper method to schedule the sync adapter periodic execution
*/
public static void configurePeriodicSync(Context context,syncInterval);
}
}
/**
* Helper method to schedule the sync adapter periodic execution
*/
public static void configurePeriodicSync(Context context,syncInterval);
}
}
项目:Super-Duo
文件:SyncAdapter.java
/**
* Set synchronisation everyday with 4 hours flexible time
* @param context
* @param account
*/
private static void setPeriodicSync(Context context,Account account) {
String authority = context.getResources().getString(R.string.content_authority);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
// we can enable inexact timers in our periodic sync
SyncRequest request = new SyncRequest.Builder().
syncPeriodic(SYNC_INTERVAL,SYNC_FLEXTIME).
setSyncAdapter(account,authority).
setExtras(Bundle.EMPTY).build();
ContentResolver.requestSync(request);
} else {
ContentResolver.addPeriodicSync(
account,Bundle.EMPTY,SYNC_INTERVAL);
}
ContentResolver.setSyncAutomatically(account,context.getString(R.string.content_authority),true);
}
/**
* Helper method to schedule the sync adapter periodic execution
*/
public static void configurePeriodicSync(Context context,syncInterval);
}
}
项目:thyroxine
文件:Utils.java
/**
* Helper method to schedule periodic execution of a sync adapter.
* flexTime is only used on KitKat and newer devices.
*/
public static void configurePeriodicSync(Account account,String authority,int flexTime) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
// we can enable inexact timers in our periodic sync
SyncRequest request = new SyncRequest.Builder()
.syncPeriodic(syncInterval,authority)
.setExtras(Bundle.EMPTY)
.build();
ContentResolver.requestSync(request);
} else {
ContentResolver.addPeriodicSync(account,syncInterval);
}
}
项目:TPlayer
文件:VContentService.java
public void syncAsUser(SyncRequest request,int userId) {
Account account = mirror.android.content.SyncRequest.mAccountToSync.get(request);
String authority = mirror.android.content.SyncRequest.mAuthority.get(request);
Bundle extras = mirror.android.content.SyncRequest.mExtras.get(request);
boolean isPeriodic = mirror.android.content.SyncRequest.mIsPeriodic.get(request);
long syncRunTimeSecs = mirror.android.content.SyncRequest.mSyncRunTimeSecs.get(request);
if (!isAccountExist(userId,account,authority)) {
return;
}
VSyncRecord.SyncRecordKey key = new VSyncRecord.SyncRecordKey(account,authority);
VSyncRecord.SyncExtras syncExtras = new VSyncRecord.SyncExtras(extras);
int isSyncable = getIsSyncableAsUser(account,userId);
synchronized (mRecords) {
Map<VSyncRecord.SyncRecordKey,VSyncRecord> map = mRecords.get(userId);
if (map == null) {
map = new HashMap<>();
mRecords.put(userId,map);
}
VSyncRecord record = map.get(key);
if (record == null) {
record = new VSyncRecord(userId,authority);
map.put(key,record);
}
if (isSyncable < 0) {
// Initialisation sync.
Bundle newExtras = new Bundle();
newExtras.putBoolean(ContentResolver.SYNC_EXTRAS_INITIALIZE,true);
record.extras.add(new VSyncRecord.SyncExtras(newExtras));
}
if (isPeriodic) {
VSyncRecord.PeriodicSyncConfig periodicSyncConfig = new VSyncRecord.PeriodicSyncConfig(syncRunTimeSecs);
record.configs.put(syncExtras,periodicSyncConfig);
} else {
record.extras.add(syncExtras);
}
}
}
项目:gito-github-client
文件:SyncAdapter.java
/**
* Helper method to schedule the sync adapter periodic execution
*/
private static void configurePeriodicSync(Context context,int flexTime) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
SyncRequest request = new SyncRequest.Builder().
syncPeriodic(syncInterval,flexTime).
setSyncAdapter(mAccount,context.getString(R.string.sync_authority)).
setExtras(new Bundle()).build();
ContentResolver.requestSync(request);
} else {
ContentResolver.addPeriodicSync(mAccount,context.getString(R.string.sync_authority),syncInterval);
}
}
项目:Cirrus
文件:FileActivity.java
protected void startSynchronization() {
Log_OC.d(TAG,"Got to start sync");
if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.KITKAT) {
Log_OC.d(TAG,"Canceling all syncs for " + MainApp.getAuthority());
ContentResolver.cancelSync(null,MainApp.getAuthority());
// cancel the current synchronizations of any ownCloud account
Bundle bundle = new Bundle();
bundle.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL,true);
bundle.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED,true);
Log_OC.d(TAG,"Requesting sync for " + getAccount().name + " at " +
MainApp.getAuthority());
ContentResolver.requestSync(
getAccount(),MainApp.getAuthority(),bundle);
} else {
Log_OC.d(TAG,"Requesting sync for " + getAccount().name + " at " +
MainApp.getAuthority() + " with new API");
SyncRequest.Builder builder = new SyncRequest.Builder();
builder.setSyncAdapter(getAccount(),MainApp.getAuthority());
builder.setExpedited(true);
builder.setManual(true);
builder.syncOnce();
// Fix bug in Android Lollipop when you click on refresh the whole account
Bundle extras = new Bundle();
builder.setExtras(extras);
SyncRequest request = builder.build();
ContentResolver.requestSync(request);
}
}
项目:dealhunting
文件:DealHuntingSyncAdapter.java
public static void configurePeriodicSync(Context context,int flexTime) {
Account account = getSyncAccount(context);
String authority = context.getString(R.string.content_authority);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
// we can enable inexact timers in our periodic sync
SyncRequest request = new SyncRequest.Builder().
syncPeriodic(syncInterval,flexTime).
setSyncAdapter(account,authority).
setExtras(new Bundle()).build();
ContentResolver.requestSync(request);
} else {
ContentResolver.addPeriodicSync(account,syncInterval);
}
}
项目:BollyFilmes
文件:FilmesSyncAdapter.java
public static void configurePeriodicSync(Context context,int flexTime) {
Account account = getSyncAccount(context);
String authority = context.getString(R.string.content_authority);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
SyncRequest syncRequest = new SyncRequest.Builder().
syncPeriodic(syncInterval,authority).
setExtras(new Bundle()).build();
ContentResolver.requestSync(syncRequest);
} else {
ContentResolver.addPeriodicSync(account,syncInterval);
}
}
项目:vertretungsplan-itg-android
文件:VertretungsplanSyncAdapter.java
/**
* Helper method to schedule the sync adapter periodic execution
*/
private static void configurePeriodicSync(Context context) {
Account account = getSyncAccount(context);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
// we can enable inexact timers in our periodic sync
SyncRequest request = new SyncRequest.Builder().
syncPeriodic(VertretungsplanSyncAdapter.SYNC_INTERVAL,VertretungsplanSyncAdapter.SYNC_FLEXTIME).
setSyncAdapter(account,VertretungsplanContract.CONTENT_AUTHORITY).setExtras(new Bundle()).build();
ContentResolver.requestSync(request);
} else {
ContentResolver.addPeriodicSync(account,VertretungsplanContract.CONTENT_AUTHORITY,VertretungsplanSyncAdapter.SYNC_INTERVAL);
}
}
项目:NSIT-Connect
文件:SyncAdapter.java
private static void configurePeriodicSync(Context context) {
Account account = getSyncAccount(context);
String authority = context.getString(R.string.content_authority);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
SyncRequest request = new SyncRequest.Builder().
syncPeriodic(SyncAdapter.SYNC_INTERVAL,SyncAdapter.SYNC_FLEXTIME).
setSyncAdapter(account,SyncAdapter.SYNC_INTERVAL);
}
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。