微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

android.content.SyncRequest的实例源码

项目: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);
    }
}
项目:Udacity_Sunshine    文件SunshinesyncAdapter.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);
    }
}
项目: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);
    }
}
项目:Advanced_Android_Development_Wear    文件SunshinesyncAdapter.java   
/**
 * Helper method to schedule the sync adapter periodic execution
 */
public static void configurePeriodicSync(Context context,syncInterval);
    }
}
项目:SunshineWithWear    文件SunshinesyncAdapter.java   
/**
 * Helper method to schedule the sync adapter periodic execution
 */
public static void configurePeriodicSync(Context context,syncInterval);
    }
}
项目:nano-go-ubiquitous    文件SunshinesyncAdapter.java   
/**
 * 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);
    }
}
项目:Go-Ubiquitous    文件SunshinesyncAdapter.java   
/**
 * 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);
    }
}
项目:Wearapp    文件SunshinesyncAdapter.java   
/**
 * Helper method to schedule the sync adapter periodic execution
 */
public static void configurePeriodicSync(Context context,syncInterval);
    }
}
项目:EarthquakeSurvival    文件SyncAdapter.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.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);
        }
    }
}
项目:go-ubiquitous    文件SunshinesyncAdapter.java   
/**
 * Helper method to schedule the sync adapter periodic execution
 */
public static void configurePeriodicSync(Context context,syncInterval);
    }
}
项目:UdacityProject6    文件SunshinesyncAdapter.java   
/**
 * Helper method to schedule the sync adapter periodic execution
 */
public static void configurePeriodicSync(Context context,syncInterval);
    }
}
项目:Sunshinewear    文件SunshinesyncAdapter.java   
/**
 * 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);
    }
}
项目:Sunshine_WeatherApp    文件SunshinesyncAdapter.java   
/**
 * Helper method to schedule the sync adapter periodic execution
 */
public static void configurePeriodicSync(Context context,syncInterval);
    }
}
项目:SunshineApp    文件SunshinesyncAdapter.java   
/**
 * Helper method to schedule the sync adapter periodic execution
 */
public static void configurePeriodicSync(Context context,syncInterval);
    }
}
项目:SunshineWear    文件SunshinesyncAdapter.java   
/**
 * Helper method to schedule the sync adapter periodic execution
 */
public static void configurePeriodicSync(Context context,syncInterval);
    }
}
项目:Sunshine-Android-Wear    文件SunshinesyncAdapter.java   
/**
 * Helper method to schedule the sync adapter periodic execution
 */
public static void configurePeriodicSync(Context context,syncInterval);
    }
}
项目:Sunshine.Wear    文件SunshinesyncAdapter.java   
/**
 * Helper method to schedule the sync adapter periodic execution
 */
public static void configurePeriodicSync(Context context,syncInterval);
    }
}
项目:Advanced_Android_Development    文件SunshinesyncAdapter.java   
/**
 * Helper method to schedule the sync adapter periodic execution
 */
public static void configurePeriodicSync(Context context,syncInterval);
    }
}
项目:Sunshine.Advanced    文件SunshinesyncAdapter.java   
/**
 * 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);
    }
}
项目:SunshineWatchFace    文件SunshinesyncAdapter.java   
/**
 * 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);
    }
}
项目:sunshine-wear    文件SunshinesyncAdapter.java   
/**
 * Helper method to schedule the sync adapter periodic execution
 */
public static void configurePeriodicSync(Context context,syncInterval);
    }
}
项目:Sunshine-Wear    文件SunshinesyncAdapter.java   
/**
 * 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);
}
项目:sunshine-wear-watchface    文件SunshinesyncAdapter.java   
/**
 * 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] 举报,一经查实,本站将立刻删除。