private long accessInfoAPI(){
  mState=SantaServiceMessages.STATUS_PROCESSING;
  final String url=String.format(Locale.US,API_URL,API_CLIENT,mPreferences.getRandValue(),mPreferences.getRouteOffset(),mPreferences.getStreamOffset(),TIMEZONE,LANGUAGE,mPreferences.getFingerprint());
  Log.d(TAG,"Tracking Santa.");
  long result=mApiProcessor.accessAPI(url);
  if (result < 0) {
    long delay=(long)Math.min((mBackoff * BACKOFF_FACTOR),MAX_BACKOFF_TIME);
    Log.d(TAG,"Couldn't communicate with Santa, trying again in: " + delay);
    mBackoff=delay;
    if (haveValidData()) {
      mState=SantaServiceMessages.STATUS_ERROR;
      sendMessage(Message.obtain(null,SantaServiceMessages.MSG_ERROR));
    }
 else {
      mState=SantaServiceMessages.STATUS_ERROR_NODATA;
      sendMessage(Message.obtain(null,SantaServiceMessages.MSG_ERROR_NODATA));
    }
    return delay;
  }
 else {
    SantaLog.d(TAG,"Accessed API, next access in: " + result);
    mBackoff=INITIAL_BACKOFF_TIME;
    sendMessage(Message.obtain(null,SantaServiceMessages.MSG_SUCCESS));
    mState=SantaServiceMessages.STATUS_IDLE;
    return result;
  }
}

private long accessInfoAPI ( ) { mState = SantaServiceMessages . STATUS_PROCESSING ; final String url = String . format ( Locale . US , API_URL , API_CLIENT , mPreferences . getRandValue ( ) , mPreferences . getRouteOffset ( ) , mPreferences . getStreamOffset ( ) , TIMEZONE , LANGUAGE , mPreferences . getFingerprint ( ) ) ; Log . d ( TAG , "Tracking Santa." ) ; long result = mApiProcessor . accessAPI ( url ) ; if ( result < 0 ) { long delay = ( long ) Math . min ( ( mBackoff * BACKOFF_FACTOR ) , MAX_BACKOFF_TIME ) ; Log . d ( TAG , "Couldn't communicate with Santa, trying again in: " + delay ) ; mBackoff = delay ; if ( haveValidData ( ) ) { mState = SantaServiceMessages . STATUS_ERROR ; sendMessage ( Message . obtain ( null , SantaServiceMessages . MSG_ERROR ) ) ; } else { mState = SantaServiceMessages . STATUS_ERROR_NODATA ; sendMessage ( Message . obtain ( null , SantaServiceMessages . MSG_ERROR_NODATA ) ) ; } return delay ; } else { SantaLog . d ( TAG , "Accessed API, next access in: " + result ) ; mBackoff = INITIAL_BACKOFF_TIME ; sendMessage ( Message . obtain ( null , SantaServiceMessages . MSG_SUCCESS ) ) ; mState = SantaServiceMessages . STATUS_IDLE ; return result ; } }
access the info api , returns the delay in ms when the api should be accessed again
