com.xunlei.downloadlib.parameter.XLConstant Java Examples

The following examples show how to use com.xunlei.downloadlib.parameter.XLConstant. 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: XLDownloadManager.java    From BtPlayer with Apache License 2.0 5 votes vote down vote up
public synchronized int init(Context context, InitParam initParam, boolean z) {
    int i = XLConstant.XLErrorCode.DOWNLOAD_MANAGER_ERROR;
    int i2 = 0;
    synchronized (this) {
        if (!mIsLoadErrcodeMsg) {
            loadErrcodeString(context);
            mIsLoadErrcodeMsg = true;
        }
        if (!(context == null || initParam == null || !initParam.checkMemberVar())) {
            this.mContext = context;
            mAllowExecution = z;
            if (mDownloadManagerState == XLManagerStatus.MANAGER_RUNNING) {
                XLLog.i(TAG, "XLDownloadManager is already init");
                Log.e(TAG, "XLDownloadManager is already init");
            } else if (this.mLoader != null) {
                String peerid = getPeerid();
                String guid = getGuid();
                XLLog.i(TAG, "Peerid:" + new String(Base64.encode(peerid.getBytes(), 0)));
                XLLog.i(TAG, "Guid:" + new String(Base64.encode(guid.getBytes(), 0)));
                if (mAllowExecution) {
                    i2 = XLUtil.getNetworkTypeComplete(context);
                }
                i = this.mLoader.init(context, initParam.mAppVersion, "", peerid, guid, initParam.mStatSavePath, initParam.mStatCfgSavePath, i2, initParam.mPermissionLevel);
                if (i != 9000) {
                    mDownloadManagerState = XLManagerStatus.MANAGER_INIT_FAIL;
                    XLLog.e(TAG, "XLDownloadManager init failed ret=" + i);
                    Log.e(TAG, "XLDownloadManager init failed ret=" + i);
                } else {
                    mDownloadManagerState = XLManagerStatus.MANAGER_RUNNING;
                    doMonitorNetworkChange();
                    setLocalProperty("PhoneModel", Build.MODEL);
                }
            }
        }
    }
    return i;
}
 
Example #2
Source File: XLDownloadManager.java    From AndroidDownload with Apache License 2.0 5 votes vote down vote up
public synchronized int init(Context context, InitParam initParam, boolean z) {
    int i = XLConstant.XLErrorCode.DOWNLOAD_MANAGER_ERROR;
    int i2 = 0;
    synchronized (this) {
        if (!mIsLoadErrcodeMsg) {
            loadErrcodeString(context);
            mIsLoadErrcodeMsg = true;
        }
        if (!(context == null || initParam == null || !initParam.checkMemberVar())) {
            this.mContext = context;
            mAllowExecution = z;
            if (mDownloadManagerState == XLManagerStatus.MANAGER_RUNNING) {
                XLLog.i(TAG, "XLDownloadManager is already init");
            } else if (this.mLoader != null) {
                String peerid = getPeerid();
                String guid = getGuid();
                XLLog.i(TAG, "Peerid:" + new String(Base64.encode(peerid.getBytes(), 0)));
                XLLog.i(TAG, "Guid:" + new String(Base64.encode(guid.getBytes(), 0)));
                if (mAllowExecution) {
                    i2 = XLUtil.getNetworkTypeComplete(context);
                }
                i = this.mLoader.init(context, initParam.mAppVersion, "", peerid, guid, initParam.mStatSavePath, initParam.mStatCfgSavePath, i2, initParam.mPermissionLevel);
                if (i != 9000) {
                    mDownloadManagerState = XLManagerStatus.MANAGER_INIT_FAIL;
                    XLLog.e(TAG, "XLDownloadManager init failed ret=" + i);
                } else {
                    mDownloadManagerState = XLManagerStatus.MANAGER_RUNNING;
                    doMonitorNetworkChange();
                    setLocalProperty("PhoneModel", Build.MODEL);
                }
            }
        }
    }
    return i;
}