Tag: 谷歌驱动 SDK

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; } […]

如何使用Java Drive Rest V2 API从Google Drive获取文档和文件的绝对路径?

我正在使用Java Drive Rest V2 API开发Google Drive Integration ,我能够获得除文档/文件路径之外的大多数文档/文件元数据属性。 我也提到了以下StackOverflow问题: 如何使用java从谷歌驱动器获取完整的文件路径 在Google Drive API v2中按“完整路径”查找文件的正确方法是什么 在两个链接中,解决方案表明我必须创建一个单独的方法来实现此要求,这意味着Drive Rest V2 API没有提供直接方法来获取文件路径。 请指导我并就此提出建议。 谢谢, Arpit

在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 […]

Google Drive SDK例外

我正在尝试运行以下代码(主要来自Stephen Wylie ): package com.googledrive.googledriveapp; // For Google Drive / Play Services // Version 1.1 – Added new comments & removed dead code // Stephen Wylie – 10/20/2012 import java.io.IOException; import java.util.ArrayList; import android.accounts.Account; import android.accounts.AccountManager; import android.app.Activity; import android.app.ProgressDialog; import android.content.Context; import android.content.DialogInterface; import android.content.DialogInterface.OnClickListener; import android.content.Intent; import android.os.AsyncTask; import android.os.Bundle; import android.util.Log; import […]

警告:无法更改每个人的权限:

在NetBeans中运行https://developers.google.com/drive/web/quickstart/java?hl=hu上的Java快速入门示例时,我收到错误代码: Jun 04, 2015 12:12:11 AM com.google.api.client.util.store.FileDataStoreFactory setPermissionsToOwnerOnly WARNING: unable to change permissions for everybody: C:\Users\Quibbles\credentials\drive-api-quickstart 我究竟做错了什么? 编辑:这是完整的错误消息。 Jun 04, 2015 5:11:39 PM com.google.api.client.util.store.FileDataStoreFactory setPermissionsToOwnerOnly WARNING: unable to change permissions for owner: C:\Users\Quibbles\.credentials\drive-api-quickstart Exception in thread “main” java.lang.NullPointerException at java.io.Reader.(Reader.java:78) at java.io.InputStreamReader.(InputStreamReader.java:72) at DriveQuickstart.authorize(DriveQuickstart.java:64) at DriveQuickstart.getDriveService(DriveQuickstart.java:87) at DriveQuickstart.main(DriveQuickstart.java:96) Java Result: 1

Google推送通知 – 未经授权的WebHook回调频道

我遇到谷歌推送通知(驱动器)的问题。 我使用的服务帐户非常适用于所有其他驱动器操作,除了驱动器更改监视。 以下是现在因“未授权的WebHook回调通道”exception而失败的应用程序代码。 我还转储了调用drive.changes.watch.execute时生成的请求和响应。 目标通知地址在API和auth推送控制面板中列入白名单(我甚至​​将其列在Javascript起源和引用中),现在我仍然坚持这个401 Unauthorized错误。 有人知道我在哪里弄错了吗? 谢谢你的帮助。 PrivateKey serviceAccountPrivateKey = SecurityUtils.loadPrivateKeyFromKeyStore(SecurityUtils.getPkcs12KeyStore(), p12File, “notasecret”, “privatekey”, “notasecret”); JsonFactory jsonFactory = new JacksonFactory(); HttpTransport t = GoogleNetHttpTransport.newTrustedTransport(); GoogleCredential gc = new GoogleCredential.Builder() .setTransport(t) .setJsonFactory(jsonFactory) .setServiceAccountScopes(Collections.singleton(DriveScopes.DRIVE)) .setServiceAccountPrivateKey(serviceAccountPrivateKey) .setServiceAccountId(Config.SERVICE_ACCOUNT_ID) .setServiceAccountUser(Config.SERVICE_ACCOUNT_USER) .build(); drive = new Drive.Builder(t, jsonFactory, null).setHttpRequestInitializer(gc).setApplicationName(cfg.getStringParam(Config.GAE_APPLICATION_NAME)).build(); // THIS WORKS Changes.List request = drive.changes().list(); ChangeList changes = request.execute(); // […]