Tag: 谷歌驱动器,Android的API

使用Android将文本文件上传到Google云端硬盘

编辑:我已将文本设置为如下字符串: String text =(“Hello!”); 我想将其转换为纯文本文件,然后上传到Google云端硬盘文件夹。 我已经尝试过下面的代码,但它没有完整,所以我不能说出现了什么错误。 我正在使用谷歌硬盘“快速启动”演示,并尝试根据我的需要定制它。 链接: https : //github.com/googledrive/android-quickstart DriverClass: public class UploadDrive extends Activity implements ConnectionCallbacks,OnConnectionFailedListener { private static final String TAG = “androiddrivequickstart”; private static final int REQUEST_CODE_CAPTURE_IMAGE = 1; private static final int REQUEST_CODE_CREATOR = 2; private static final int REQUEST_CODE_RESOLUTION = 3; private GoogleApiClient mGoogleApiClient; private Bitmap mBitmapToSave; private […]

Filters.ownedByMe无法在“Android版Drive API”中使用(但在“API Client Library for Java”中正常使用)

以前,我正在使用“API Client Library for Java”在appdata文件夹中执行文件搜索。 在API Client Library for Java中搜索代码 private static void searchFromGoogleDrive(Drive drive, String qString) { try { Files.List request = drive.files().list().setQ(qString); do { FileList fileList = request.execute(); for (com.google.api.services.drive.model.File f : fileList.getItems()) { final String title = f.getTitle(); if (title == null || f.getDownloadUrl() == null || f.getDownloadUrl().length() 0); } catch (IOException […]

使用android.gms.drive从android删除/删除文件

我需要使用com.google.android.gms.drive从Google云端硬盘中删除文件。 从我在这里和网上看到的内容,“新API”中不支持删除文件。 那(还)是正确的吗? 我的意思是API不再那么新了…… 我还读到了“明确的内容和忘记” – 策略,但我不想遵循这种方法。 问题的第2部分:鉴于仍然无法通过上述API删除文件; 是否有任何简单的方法将REST API与我已编写的代码结合起来? 就像是 从GoogleApiClient获取令牌 使用令牌和文件ID激活DELETE请求 ??? 利润 编辑:新的Google Play服务(版本7.0.0 / 2015年3月)最终具有trash()方法。 有关详细信息,请参阅https://developer.android.com/reference/com/google/android/gms/drive/DriveResource.html 。 。 edit2:显然你不能对app文件夹中的文件使用trash() : Cannot trash App Folder or files inside the App Folder. :(( edit3:截至5月28日,现在可以实际删除文件。

Google Drive Android API – 无效的DriveId和Null ResourceId

我一整天都没有运气就与这段代码作斗争。 我开始关注Google的代码示例 。 问题是文件夹成功创建但在onResult()中 ,我总是得到一个无效或不完整的DriveId或resourceId。 这意味着我无法在我创建的文件夹中创建文件。 这是我正在使用的代码: public class CreateFolderActivity extends BaseDemoActivity { @Override public void onConnected(Bundle connectionHint) { super.onConnected(connectionHint); MetadataChangeSet changeSet = new MetadataChangeSet.Builder() .setTitle(“MyAppFolder”).build(); Drive.DriveApi.getRootFolder(getGoogleApiClient()).createFolder( getGoogleApiClient(), changeSet).setResultCallback(callback); } final ResultCallback callback = new ResultCallback() { @Override public void onResult(DriveFolderResult result) { if (!result.getStatus().isSuccess()) { showMessage(“Error while trying to create the folder”); return; } […]

在Android上获取所有文件夹google drive api

我使用新的谷歌驱动器API,我无法从我的谷歌驱动器获取所有文件夹,我只获得我用谷歌驱动器API创建的文件夹…任何人都知道为什么会这样? 这是我的代码: @Override protected void onResume() { super.onResume(); if (mGoogleApiClient == null) { // Create the API client and bind it to an instance variable. // We use this instance as the callback for connection and connection // failures. // Since no account name is passed, the user is prompted to choose. mGoogleApiClient = new […]