static long incrementAndGetTime ( Context context ) { Context appContext = context . getApplicationContext ( ) ; String key = appContext . getString ( R . string . wings__retry_policy_consecutive_fails ) ; // Get the number of consecutive fails. SharedPreferences preferences = PreferenceManager . getDefaultSharedPreferences ( appContext ) ; int consecutiveFails = preferences . getInt ( key , 0 ) ; // Synchronously increment the consecutive fail count. Editor editor = preferences . edit ( ) ; editor . putInt ( key , consecutiveFails + 1 ) ; editor . commit ( ) ; return getFibonacci ( consecutiveFails ) * MINUTE_TO_MILLIS ; }
Gets how far in the future to schedule the next attempt to share . An internal counter is incremented every time this method gets called so a subsequent call will return a different time .