2013-02-10 38 views
1

讓我們的列表文件:如何從谷歌雲端硬盤中設置谷歌驅動器訪問超時在Android

GoogleAccountCredential credential = GoogleAccountCredential.usingOAuth2(
    context, DriveScopes.DRIVE); 
Drive service = new Drive.Builder(AndroidHttp.newCompatibleTransport(), 
    new GsonFactory(), credential).build(); 
service.files().list().execute(); 

然而,執行()需要近永遠實現舉例來說,如果沒有可用的網絡連接。

從GoogleAccountCredential的來源可以看出,它使用了ExponentialBackOffPolicy,默認情況下它的最大流逝時間限制爲15分鐘。

問題1:是否有方法來覆蓋此行爲並將超時限制設置爲較低值?

問題2:service.files().list()。execute()正在AsyncTask中運行。如果她不想等待15分鐘超時,根據用戶請求取消它的正確方法是什麼?

回答

相關問題