app/src/main/java/net/sky/scweather/sync/WeatherSyncAdapter.java
private static void configurePeriodicSync(Context context, int syncInterval, 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
            SyncRequest request = new SyncRequest.Builder().syncPeriodic(syncInterval, syncFlextime).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
     */
Helper method to schedule the sync adapter periodic execution
Helper method to schedule the sync adapter periodic execution
private static void configurePeriodicSync(Context context, int syncInterval, int syncFlextime) {
        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(syncInterval, syncFlextime).setSyncAdapter(account, authority).setExtras(new Bundle()).build();
            ContentResolver.requestSync(request);
        } else {
            ContentResolver.addPeriodicSync(account, authority, new Bundle(), syncInterval);
        }
    }
private static void configurePeriodicSync ( Context context , int syncInterval , int syncFlextime ) { 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 ( syncInterval , syncFlextime ) . 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
Helper method to schedule the sync adapter periodic execution
// we can enable inexact timers in our periodic sync
