0
嗨我開發一個帶Dropbox支持的應用程序。Dropbox API - 如果沒有互聯網連接會發生什麼
我完成身份驗證,一切工作正常。
當我關閉互聯網連接,並嘗試上傳文件時,我收到成功回撥... !!!
之後,如果我切換互聯網上沒有任何反應。
這是事情發生的方式還是我錯了?
下面是我用上傳
FileInputStream inputStream = null;
try {
File file = new File("/path to my file.txt");
inputStream = new FileInputStream(file);
Entry newEntry = mDBApi.putFileOverwrite("/path to my file.txt", inputStream, file.length(), null);
Log.i("DbExampleLog", "The uploaded file's rev is: " + newEntry.rev);
} catch (DropboxUnlinkedException e) {
// User has unlinked, ask them to link again here.
Log.e("DbExampleLog", "User has unlinked.");
} catch (DropboxException e) {
Log.e("DbExampleLog", "Something went wrong while uploading.");
} catch (FileNotFoundException e) {
Log.e("DbExampleLog", "File not found.");
} finally {
if (inputStream != null) {
try {
inputStream.close();
} catch (IOException e) {}
}
}
也許它拋出一個異常類型,你不處理...我通常拋出一個catch(Exception e)'作爲一個全部。祝你好運。 –