綁定帳號登入

Android 台灣中文網

打印 上一主題 下一主題

[討論] Google Drive API 上傳權限問題?

[複製連結] 查看: 1727|回覆: 0|好評: 0
跳轉到指定樓層
樓主
王進平 | 收聽TA | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式
發表於 2015-12-4 11:03

馬上加入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();

會失敗

畫面顯示如附件

我翻譯後好像是缺少權限

不知道是我沒有要求權限還是我程是這樣改是錯誤的?
「用Android 就來APK.TW」,快來加入粉絲吧!
Android 台灣中文網(APK.TW)
收藏收藏 分享分享 分享專題
用Android 就來Android 台灣中文網(https://apk.tw)
回覆

使用道具 舉報

您需要登錄後才可以回帖 登錄 | 註冊

本版積分規則