1
私は機能があり、正常に動作しています!しかしそのパスでドライブID?ドライブIDが削除または破棄された場合はどうなりますか?DriveIdなしでAppフォルダgoogleドライブからファイルを読み取る方法は?
は、ドライブIDを見つける方法ですか?
私は共有好み
から私のドライブIDを逃した場合、私は=======
- ユーザーに再参加私のアプリや変更デバイス
- ようなシナリオで困難に直面=============================== 私作業ファンクション
readFromGooDrive(DriveId mDriveId) { byte[] buf = null; if (getGoogleApiClient() != null && getGoogleApiClient().isConnected()) try { DriveFile df = Drive.DriveApi.getFile(getGoogleApiClient(), mDriveId); df.open(getGoogleApiClient(), DriveFile.MODE_READ_ONLY, null) .setResultCallback(new ResultCallback<DriveContentsResult>() { @Override public void onResult(DriveContentsResult driveContentsResult) { if ((driveContentsResult != null) && driveContentsResult.getStatus().isSuccess()) { DriveContents contents = driveContentsResult.getDriveContents(); BufferedInputStream bis = new BufferedInputStream(contents.getInputStream()); byte[] buffer = new byte[1024]; int bytesread = 0; FileOutputStream outStream; try { String databasePath = getBaseContext().getDatabasePath("my database").getPath(); outStream = new FileOutputStream(databasePath); while((bytesread = bis.read(buffer)) != -1) { outStream.write(buffer,0,bytesread); } outStream.flush(); bis.close(); outStream.close(); } catch (FileNotFoundException e) { Log.i(TAG,e.getMessage()); } catch (IOException e) { Log.i(TAG,e.getMessage()); } finally { Toast.makeText(getBaseContext(),"Data from Google Drive restored successfully." , Toast.LENGTH_LONG).show(); } contents.discard(getGoogleApiClient()); } } }); } catch (Exception e) { e.printStackTrace(); } }
その作業完璧仲間を必要とし、このリンクを読んで:私はdriveID – dipali
を使用する必要はありませんが、あなたができると思うhttps://developers.google.com/drive/android/auth を'DriveId'が削除されるという例を挙げてください。 – Teyam
mydbファイルをappフォルダのドライブにアップロードしています。今、私はアプリをアンインストールしてからもう一度インストールして、アプリのフォルダの内容を取得しようとしていますが、DriveIdなしでは得られません。 – Harish