0
Google 드라이브에 앱 데이터를 저장하여 사용자의 기기간에 공유하려고합니다. 내가 파일을 열 콜백에서Google 드라이브 Android SDK가 앱 폴더에 쓸 수 없음
Drive.DriveApi.getAppFolder(driveApiClient)
.createFile(driveApiClient, changeSet, null)
:
driveFileResult.getDriveFile().open(driveApiClient, DriveFile.MODE_WRITE_ONLY, null)
그리고 내가 파일에 기록하는 콜백에서
바와 같이처음에는 내가 구글 드라이브에 하나를 만들 파일이없는 경우 https://developers.google.com/drive/android/files#making_modifications : 커밋의 상태 콜백에서
DriveContents contents = driveContentsResult.getDriveContents();
try {
ParcelFileDescriptor parcelFileDescriptor = contents.getParcelFileDescriptor();
FileOutputStream fileOutputStream = new FileOutputStream(parcelFileDescriptor
.getFileDescriptor());
Writer writer = new OutputStreamWriter(fileOutputStream);
writer.write("hello world");
} catch (IOException e) {
e.printStackTrace();
}
contents.commit(driveApiClient, null, new ExecutionOptions.Builder().setConflictStrategy(ExecutionOptions.CONFLICT_STRATEGY_OVERWRITE_REMOTE).build())
은 내가 성공을 얻을.
다음 번에 내가 파일이 비어있는 파일을 열고, 메타 데이터의 크기 내가 뭘 잘못 0
입니까?
'OutputStreamWriter'를 닫으십시오. 파일을 어떻게 읽니? 그것이 비어 있음을 어떻게 알 수 있습니까? 'appDataFolder'에서 스코프를 옮겨서 육안 검사를 할 수 있습니다. 또한 GDAA를 통해 작성된 파일은 나중에 서버에 동기화되며 나중에 사용자가 제어 할 수 없게됩니다. – Cheticamp