【发布时间】:2017-04-09 16:26:05
【问题描述】:
我不知道我哪里出错了,但是按照下面的链接并使用 Google 文档,我一无所获。
https://www.numetriclabz.com/integrate-google-drive-in-android-tutorial/
而且这段代码似乎不起作用(Drive.API 无法识别):
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addApi(Drive.API)
.addScope(Drive.SCOPE_FILE)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.build();
我已将 API 密钥和 Google 服务版本添加到 Manifest,但该网站不允许我发布它。
这很奇怪,谷歌登录就像一个魅力。
GoogleSignInOptions gso = new
GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestEmail()
.build();
mGoogleApiClient = new GoogleApiClient.Builder(this)
.enableAutoManage(this /* FragmentActivity */, this /*
OnConnectionFailedListener */)
.addApi(Auth.GOOGLE_SIGN_IN_API, gso)
.build();
这让我很困惑。在 console.developers 上,我启用了 google drive。在 gradle 中,我正在导入 google-services,所以没有专门导入 Google Drive,但我认为这不是问题所在。不要犹豫,问我更多问题或要求截图。
【问题讨论】:
-
我确实试过了,因为它在我写的个人日志中,但现在看来。谢谢。
标签: android google-api google-drive-api