我正在使用this tutorial在Android上刻录驱动器。我在内部存储上有一个文件,我想在Drive上复制它,如下所示:
FileOutputStream fos = openFileOutput(filename,
Context.MODE_PRIVATE);
fos.write("hello");
fos.close();
教程中的“将文件插入Application Data文件夹”部分说:
// File's content.
java.io.File fileContent = new java.io.File(filename);
FileContent mediaContent = new FileContent(mimeType, fileContent);
try {
File file = service.files().insert(body, mediaContent).execute();
return file;
//...
我该怎么办?
编辑:我希望这段代码能够正常运行,但事实并非如此:
// File's content.
java.io.File fileContent = new java.io.File(filename);
FileOutputStream fos = new FileOutputStream(fileContent);
fos.write("hello");
fos.close();
FileContent mediaContent = new FileContent(mimeType, fileContent);
try {
File file = service.files().insert(body, mediaContent).execute();
return file;
//...
编辑:
我收到这些错误,我不知道如何解决这些错误:
04-15 12:12:24.615: W/AbstractGoogleClient(2272): Application name is not set. Call Builder#setApplicationName.
04-15 12:12:24.615: I/System.out(2272): An error occured: java.io.FileNotFoundException: /filename: open failed: EROFS (Read-only file system)