久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

可以取消 Google 云端硬盤上傳嗎?

Cancel Google Drive upload possible?(可以取消 Google 云端硬盤上傳嗎?)
本文介紹了可以取消 Google 云端硬盤上傳嗎?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我已經(jīng)使用官方 API 編寫了一個應(yīng)用程序來上傳到 Google 驅(qū)動器,這非常有效.但是我無論如何都找不到取消上傳.我在 ASyncTask 中運行它,到目前為止,我已經(jīng)嘗試使驅(qū)動器對象、文件路徑、令牌和其他一些變量都沒有.我也嘗試過使令牌無效,但似乎這只是將其從緩存中刪除,實際上并沒有使其服務(wù)器端無效.我在 ASyncTask 上調(diào)用了取消,但是如果在上傳開始后取消它,似乎無法停止它.

I have written an app using the official API to upload to Google drive, this works perfectly. However I can't find anyway to cancel an upload. I'm running it in an ASyncTask, so far I have tried making the drive object, the file path, the token and a few other variables none. I've also tried to invalidate the token however it seems this only removes it from the cache and doesn't actually invalidate it server side. I've called cancel on the ASyncTask however if it is cancelled once the upload has started there seems to be no way to stop it.

我的問題是,如果用戶開始上傳一個 100mb 的文件,除了打開和關(guān)閉互聯(lián)網(wǎng)連接之外,他們無法取消它,這是不切實際的.這是我的上傳代碼:

My issue is if a user starts uploading a 100mb file there's no way for them to cancel it other then turning their internet connection on and off which isn't practical. This is my upload code:

  java.io.File jFile = new java.io.File(path); //Does not get file just info
                File body = setBody(jFile, mimeType);
                try
                {
                  java.io.File mediaFile = new java.io.File(path);
                  InputStreamContent mediaContent =
                      new InputStreamContent(mimeType,
                          new BufferedInputStream(new FileInputStream(mediaFile)));
                  mediaContent.setLength(mediaFile.length());
                  request = drive.files().insert(body, mediaContent);
                  request.getMediaHttpUploader().setProgressListener(new CustomProgressListener());
                  File file = request.execute();

肯定有辦法取消上傳嗎?

Surely there is a way to cancel an upload?

推薦答案

好問題!我提交了取消媒體上傳請求的功能請求:

Great question! I filed a feature request for the ability to cancel a media upload request:

https://code.google.com/p/google-api-java-client/issues/detail?id=671

但是,根據(jù)該庫的當前設(shè)計,這可能是一個難以實現(xiàn)的功能.

However, this may a difficult feature to implement based on the current design of that library.

另一個要考慮的選項是不使用 AsyncTask,而是自己實現(xiàn)多線程并中止正在運行的線程.不愉快,但可能是您現(xiàn)在這樣做的唯一選擇.

Another option to consider is to not use AsyncTask and instead implementing the multi-threading yourself and abort the running Thread. Not pleasant, but may be your only option for doing this now.

這篇關(guān)于可以取消 Google 云端硬盤上傳嗎?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

Upload progress listener not fired (Google drive API)(上傳進度偵聽器未觸發(fā)(Google 驅(qū)動器 API))
Save file in specific folder with Google Drive SDK(使用 Google Drive SDK 將文件保存在特定文件夾中)
Google Drive Android API - Invalid DriveId and Null ResourceId(Google Drive Android API - 無效的 DriveId 和 Null ResourceId)
Google drive api services account view uploaded files to google drive using java(谷歌驅(qū)動api服務(wù)賬戶查看上傳文件到谷歌驅(qū)動使用java)
Google Drive service account returns 403 usageLimits(Google Drive 服務(wù)帳號返回 403 usageLimits)
com.google.api.client.json.jackson.JacksonFactory; missing in Google Drive example(com.google.api.client.json.jackson.JacksonFactory;Google Drive 示例中缺少)
主站蜘蛛池模板: www.男人天堂.com | 久久久精品影院 | 日韩综合在线 | 久久久激情| av手机在线 | 毛片视频免费观看 | 亚洲伊人久久综合 | 黄色一级电影免费观看 | 国产精品亚洲成在人线 | 网址黄| 成人免费观看网站 | 欧美激情久久久 | 久久99视频这里只有精品 | 免费av电影网站 | 亚洲一区中文字幕 | 视频一区二区三区四区五区 | 日韩精品一区二 | 久久久无码精品亚洲日韩按摩 | 亚洲伊人久久综合 | 国产精品免费一区二区三区四区 | 在线国产精品一区 | а天堂中文最新一区二区三区 | 日本一本在线 | 毛片一级片 | 国产在线精品一区二区三区 | 欧美一区二区在线观看 | 国产一区二区三区欧美 | 亚洲免费av一区 | 中文字幕av网站 | 日本精品久久久一区二区三区 | 女女爱爱视频 | 一级看片免费视频 | 久久国产精品无码网站 | 色婷婷久久久久swag精品 | 欧美精品一区二区在线观看 | 国产特级毛片 | 亚洲 欧美 激情 另类 校园 | 91在线观看视频 | 国产午夜三级一区二区三 | 一级片在线视频 | 国产影音先锋 |