private void download(String url) { try { mFile = FileUtil.getDestinationInExternalPublicDir( getFileDownloadPath(), mFileObject.getSaveName(mProjectObjectId)); PersistentCookieStore cookieStore = new PersistentCookieStore(AttachmentsDownloadDetailActivity.this); String cookieString = ""; for (Cookie cookie : cookieStore.getCookies()) { cookieString += cookie.getName() + "=" + cookie.getValue() + ";"; } DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url)); request.addRequestHeader("Cookie", cookieString); request.setDestinationInExternalPublicDir( getFileDownloadPath(), mFileObject.getSaveName(mProjectObjectId)); request.setTitle(mFileObject.getName()); // request.setDescription(mFileObject.name); // request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED); request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_HIDDEN); request.setVisibleInDownloadsUi(false); // request.allowScanningByMediaScanner(); // request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI); // request.setShowRunningNotification(false); downloadId = downloadManager.enqueue(request); downloadListEditor.putLong(mFileObject.file_id, downloadId); downloadListEditor.commit(); } catch (Exception e) { Toast.makeText(this, R.string.no_system_download_service, Toast.LENGTH_LONG).show(); } }
public void printCookies() { System.out.println("cookise " + persistentCookieStore.getCookies().size()); }
public List<cz.msebera.android.httpclient.cookie.Cookie> getCookies() { return myCookieStore.getCookies(); }