馬上加入Android 台灣中文網,立即免費下載應用遊戲。
您需要 登錄 才可以下載或查看,沒有帳號?註冊
x
我最近再嘗試上傳SQLite 到雲端的功能
但遇到了一些問題
我使用[url= https://developers.google.com/drive/web/quickstart/android] https://developers.google.com/drive/web/quickstart/android[/url]
這網頁所提供的程式碼
執行後沒有問題 就是顯示10筆該帳號最近上傳的Titel和ID
然後我參考 http://anything0951.blogspot.tw/2013/07/eclipse-java-google-drive-api.html
針對程式做了一些修改
我在原本程式內的getDataFromApi()函式裡面加上了
SQLite_ SQL=new SQLite_(Two_Sec_Billing_GoogleDrive_API.this);
File body = new File();
body.setTitle("My document");
body.setDescription("A test document");
body.setMimeType("application/x-sqlite3");
java.io.File fileContent = new java.io.File(SQL.DB_PATH+SQL.DB_NAME);
FileContent mediaContent = new FileContent("application/x-sqlite3", fileContent);
System.out.println("test__1");
File mfile = mService.files().insert(body, mediaContent).execute();
System.out.println("File ID: " + mfile.getId());
SQL.DB_PATH =SQLite路徑
SQL.DB_NAME =SQLite名稱
這個路徑我有用來複製檔案,所以這路徑是沒有問題的
但執行到
File mfile = mService.files().insert(body, mediaContent).execute();
會失敗
畫面顯示如附件
我翻譯後好像是缺少權限
不知道是我沒有要求權限還是我程是這樣改是錯誤的?
|