com.xunlei.downloadlib.parameter.InitParam Java Examples

The following examples show how to use com.xunlei.downloadlib.parameter.InitParam. 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 TVRemoteIME with GNU General Public License v2.0 5 votes vote down vote up
public synchronized int init(Context context, InitParam initParam, boolean z) {
    int i = 9900;
    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(initParam.mAppKey, "com.xunlei.downloadprovider", initParam.mAppVersion, "", peerid, guid, initParam.mStatSavePath, initParam.mStatCfgSavePath, i2, initParam.mPermissionLevel);
                if (i != 9000) {
                    mDownloadManagerState = XLManagerStatus.MANAGER_INIT_FAIL;
                } else {
                    mDownloadManagerState = XLManagerStatus.MANAGER_RUNNING;
                    doMonitorNetworkChange();
                    setLocalProperty("PhoneModel", Build.MODEL);
                }
            }
        }
    }
    return i;
}
 
Example #2
Source File: XLTaskHelper.java    From BtPlayer with Apache License 2.0 5 votes vote down vote up
public static void init(Context context) {
    XLDownloadManager instance = XLDownloadManager.getInstance();
    InitParam initParam = new InitParam();
    initParam.mAppKey = "bpIzNjAxNTsxNTA0MDk0ODg4LjQyODAwMA&&OxNw==^a2cec7^10e7f1756b15519e20ffb6cf0fbf671f";
    initParam.mAppVersion = "5.45.2.5080";
    initParam.mStatSavePath = context.getFilesDir().getPath();
    initParam.mStatCfgSavePath = context.getFilesDir().getPath();
    initParam.mPermissionLevel = 2;
    instance.init(context, initParam);
    instance.setOSVersion(Build.VERSION.INCREMENTAL);
    instance.setSpeedLimit(-1, -1);
    XLDownloadManager.getInstance().setUserId("");
}
 
Example #3
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 #4
Source File: XLTaskHelper.java    From AndroidDownload with Apache License 2.0 5 votes vote down vote up
public static void init(Context context) {
    XLDownloadManager instance = XLDownloadManager.getInstance();
    InitParam initParam = new InitParam();
    initParam.mAppKey = "bpIzNjAxNTsxNTA0MDk0ODg4LjQyODAwMA&&OxNw==^a2cec7^10e7f1756b15519e20ffb6cf0fbf671f";
    initParam.mAppVersion = "5.45.2.5080";
    //initParam.mAppVersion = "5.65.2.5680";
    initParam.mStatSavePath = context.getFilesDir().getPath();
    initParam.mStatCfgSavePath = context.getFilesDir().getPath();
    initParam.mPermissionLevel = 2;
    instance.init(context, initParam);
    instance.setOSVersion(Build.VERSION.INCREMENTAL);
    instance.setSpeedLimit(-1, -1);
    XLDownloadManager.getInstance().setUserId("");
}
 
Example #5
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;
}
 
Example #6
Source File: XLTaskHelper.java    From MiniThunder with Apache License 2.0 5 votes vote down vote up
public static void init(Context context) {
    XLDownloadManager instance = XLDownloadManager.getInstance();
    InitParam initParam = new InitParam();
    initParam.mAppKey = "xzNjAwOQ^^yb==aa214316d5e0a63a5b58db24557fa2^e";
    initParam.mAppVersion = "5.41.2.4980";
    initParam.mStatSavePath = context.getFilesDir().getPath();
    initParam.mStatCfgSavePath = context.getFilesDir().getPath();
    initParam.mPermissionLevel = 2;
    instance.init(context, initParam);
    instance.setOSVersion(Build.VERSION.INCREMENTAL);
    instance.setSpeedLimit(-1, -1);
    XLDownloadManager.getInstance().setUserId("");
}
 
Example #7
Source File: XLDownloadManager.java    From TVRemoteIME with GNU General Public License v2.0 4 votes vote down vote up
public synchronized int init(Context context, InitParam initParam) {
    return init(context, initParam, true);
}
 
Example #8
Source File: XLDownloadManager.java    From BtPlayer with Apache License 2.0 4 votes vote down vote up
public synchronized int init(Context context, InitParam initParam) {
    return init(context, initParam, true);
}
 
Example #9
Source File: XLDownloadManager.java    From AndroidDownload with Apache License 2.0 4 votes vote down vote up
public synchronized int init(Context context, InitParam initParam) {
    return init(context, initParam, true);
}
 
Example #10
Source File: XLDownloadManager.java    From MiniThunder with Apache License 2.0 4 votes vote down vote up
public synchronized int init(Context context, InitParam initParam) {
    return init(context, initParam, true);
}
 
Example #11
Source File: XLDownloadManager.java    From MiniThunder with Apache License 2.0 4 votes vote down vote up
public synchronized int init(Context context, InitParam initParam, boolean z) {
    int i = 9900;
    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) {
                this.mAppkeyChecker = new XLAppKeyChecker(context, initParam.mAppKey);
                if (this.mAppkeyChecker.verify()) {
                    XLLog.i(TAG, "appKey check successful");
                    String soAppKey = this.mAppkeyChecker.getSoAppKey();
                    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(soAppKey, "com.xunlei.downloadprovider", initParam.mAppVersion, "", peerid, guid, initParam.mStatSavePath, initParam.mStatCfgSavePath, i2, initParam.mPermissionLevel);
                    if (i != 9000) {
                        mDownloadManagerState = XLManagerStatus.MANAGER_INIT_FAIL;
                    } else {
                        mDownloadManagerState = XLManagerStatus.MANAGER_RUNNING;
                        doMonitorNetworkChange();
                        setLocalProperty("PhoneModel", Build.MODEL);
                    }
                } else {
                    XLLog.i(TAG, "appKey check failed");
                    i = 9901;
                }
            }
        }
    }
    return i;
}