Java Code Examples for com.google.android.vending.expansion.downloader.Constants#MAX_RETRIES

The following examples show how to use com.google.android.vending.expansion.downloader.Constants#MAX_RETRIES . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DownloadThread.java    From travelguide with Apache License 2.0 6 votes vote down vote up
/**
 * Check the HTTP response status and handle anything unusual (e.g. not
 * 200/206).
 */
private void handleExceptionalStatus(State state, InnerState innerState, HttpResponse response)
        throws StopRequest, RetryDownload {
    int statusCode = response.getStatusLine().getStatusCode();
    if (statusCode == 503 && mInfo.mNumFailed < Constants.MAX_RETRIES) {
        handleServiceUnavailable(state, response);
    }
    if (statusCode == 301 || statusCode == 302 || statusCode == 303 || statusCode == 307) {
        handleRedirect(state, response, statusCode);
    }

    int expectedStatus = innerState.mContinuingDownload ? 206
            : DownloaderService.STATUS_SUCCESS;
    if (statusCode != expectedStatus) {
        handleOtherStatus(state, innerState, statusCode);
    } else {
        // no longer redirected
        state.mRedirectCount = 0;
    }
}
 
Example 2
Source File: DownloadThread.java    From Alite with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Check the HTTP response status and handle anything unusual (e.g. not
 * 200/206).
 */
private void handleExceptionalStatus(State state, InnerState innerState, HttpResponse response)
        throws StopRequest, RetryDownload {
    int statusCode = response.getStatusLine().getStatusCode();
    if (statusCode == 503 && mInfo.mNumFailed < Constants.MAX_RETRIES) {
        handleServiceUnavailable(state, response);
    }
    if (statusCode == 301 || statusCode == 302 || statusCode == 303 || statusCode == 307) {
        handleRedirect(state, response, statusCode);
    }

    int expectedStatus = innerState.mContinuingDownload ? 206
            : DownloaderService.STATUS_SUCCESS;
    if (statusCode != expectedStatus) {
        handleOtherStatus(state, innerState, statusCode);
    } else {
        // no longer redirected
        state.mRedirectCount = 0;
    }
}
 
Example 3
Source File: DownloadThread.java    From QtAndroidTools with MIT License 5 votes vote down vote up
/**
 * Check the HTTP response status and handle anything unusual (e.g. not
 * 200/206).
 */
private void handleExceptionalStatus(State state, InnerState innerState, HttpURLConnection connection, int responseCode)
        throws StopRequest, RetryDownload {
    if (responseCode == 503 && mInfo.mNumFailed < Constants.MAX_RETRIES) {
        handleServiceUnavailable(state, connection);
    }
    int expectedStatus = innerState.mContinuingDownload ? 206
            : DownloaderService.STATUS_SUCCESS;
    if (responseCode != expectedStatus) {
        handleOtherStatus(state, innerState, responseCode);
    } else {
        // no longer redirected
        state.mRedirectCount = 0;
    }
}
 
Example 4
Source File: DownloadThread.java    From QtAndroidTools with MIT License 5 votes vote down vote up
private int getFinalStatusForHttpError(State state) {
    if (mService.getNetworkAvailabilityState(mDB) != DownloaderService.NETWORK_OK) {
        return DownloaderService.STATUS_WAITING_FOR_NETWORK;
    } else if (mInfo.mNumFailed < Constants.MAX_RETRIES) {
        state.mCountRetry = true;
        return DownloaderService.STATUS_WAITING_TO_RETRY;
    } else {
        Log.w(Constants.TAG, "reached max retries for " + mInfo.mNumFailed);
        return DownloaderService.STATUS_HTTP_DATA_ERROR;
    }
}
 
Example 5
Source File: DownloadThread.java    From play-apk-expansion with Apache License 2.0 5 votes vote down vote up
/**
 * Check the HTTP response status and handle anything unusual (e.g. not
 * 200/206).
 */
private void handleExceptionalStatus(State state, InnerState innerState, HttpURLConnection connection, int responseCode)
        throws StopRequest, RetryDownload {
    if (responseCode == 503 && mInfo.mNumFailed < Constants.MAX_RETRIES) {
        handleServiceUnavailable(state, connection);
    }
    int expectedStatus = innerState.mContinuingDownload ? 206
            : DownloaderService.STATUS_SUCCESS;
    if (responseCode != expectedStatus) {
        handleOtherStatus(state, innerState, responseCode);
    } else {
        // no longer redirected
        state.mRedirectCount = 0;
    }
}
 
Example 6
Source File: DownloadThread.java    From play-apk-expansion with Apache License 2.0 5 votes vote down vote up
private int getFinalStatusForHttpError(State state) {
    if (mService.getNetworkAvailabilityState(mDB) != DownloaderService.NETWORK_OK) {
        return DownloaderService.STATUS_WAITING_FOR_NETWORK;
    } else if (mInfo.mNumFailed < Constants.MAX_RETRIES) {
        state.mCountRetry = true;
        return DownloaderService.STATUS_WAITING_TO_RETRY;
    } else {
        Log.w(Constants.TAG, "reached max retries for " + mInfo.mNumFailed);
        return DownloaderService.STATUS_HTTP_DATA_ERROR;
    }
}
 
Example 7
Source File: DownloadThread.java    From travelguide with Apache License 2.0 5 votes vote down vote up
private int getFinalStatusForHttpError(State state) {
    if (mService.getNetworkAvailabilityState(mDB) != DownloaderService.NETWORK_OK) {
        return DownloaderService.STATUS_WAITING_FOR_NETWORK;
    } else if (mInfo.mNumFailed < Constants.MAX_RETRIES) {
        state.mCountRetry = true;
        return DownloaderService.STATUS_WAITING_TO_RETRY;
    } else {
        Log.w(Constants.TAG, "reached max retries for " + mInfo.mNumFailed);
        return DownloaderService.STATUS_HTTP_DATA_ERROR;
    }
}
 
Example 8
Source File: DownloadThread.java    From Alite with GNU General Public License v3.0 5 votes vote down vote up
private int getFinalStatusForHttpError(State state) {
    if (mService.getNetworkAvailabilityState(mDB) != DownloaderService.NETWORK_OK) {
        return DownloaderService.STATUS_WAITING_FOR_NETWORK;
    } else if (mInfo.mNumFailed < Constants.MAX_RETRIES) {
        state.mCountRetry = true;
        return DownloaderService.STATUS_WAITING_TO_RETRY;
    } else {
        Log.w(Constants.TAG, "reached max retries for " + mInfo.mNumFailed);
        return DownloaderService.STATUS_HTTP_DATA_ERROR;
    }
}
 
Example 9
Source File: DownloadThread.java    From UnityOBBDownloader with Apache License 2.0 5 votes vote down vote up
/**
 * Check the HTTP response status and handle anything unusual (e.g. not
 * 200/206).
 */
private void handleExceptionalStatus(State state, InnerState innerState, HttpURLConnection connection, int responseCode)
        throws StopRequest, RetryDownload {
    if (responseCode == 503 && mInfo.mNumFailed < Constants.MAX_RETRIES) {
        handleServiceUnavailable(state, connection);
    }
    int expectedStatus = innerState.mContinuingDownload ? 206
            : DownloaderService.STATUS_SUCCESS;
    if (responseCode != expectedStatus) {
        handleOtherStatus(state, innerState, responseCode);
    } else {
        // no longer redirected
        state.mRedirectCount = 0;
    }
}
 
Example 10
Source File: DownloadThread.java    From UnityOBBDownloader with Apache License 2.0 5 votes vote down vote up
private int getFinalStatusForHttpError(State state) {
    if (mService.getNetworkAvailabilityState(mDB) != DownloaderService.NETWORK_OK) {
        return DownloaderService.STATUS_WAITING_FOR_NETWORK;
    } else if (mInfo.mNumFailed < Constants.MAX_RETRIES) {
        state.mCountRetry = true;
        return DownloaderService.STATUS_WAITING_TO_RETRY;
    } else {
        Log.w(Constants.TAG, "reached max retries for " + mInfo.mNumFailed);
        return DownloaderService.STATUS_HTTP_DATA_ERROR;
    }
}