简体   繁体   English

android google drive sdk 和 dropbox sdk

[英]android google drive sdk and dropbox sdk

I'm working on file manager application for android.我正在开发适用于 android 的文件管理器应用程序。 I use dropbox and google drive sdk.我使用 dropbox 和 google drive sdk。 I want to implement some kind of Factory of cloud storage.我想实现某种云存储工厂。 eg if user selects google drive I'd create GoogleDriveClient whic inplements MyClient interface and use it.例如,如果用户选择谷歌驱动器,我会创建 GoogleDriveClient 来实现 MyClient 接口并使用它。 if user selects DropBox I'd create DropBoxClient which implements MyClient interface and use it.如果用户选择 DropBox,我会创建 DropBoxClient 来实现 MyClient 接口并使用它。 But there is a problem that I need activity in this client, because of sdk.. please provide your thoughts how can i make some abstraction of my cloud clients.但是有一个问题,我需要在这个客户端进行活动,因为 sdk .. 请提供您的想法,我如何对我的云客户端进行一些抽象。 Thank you.谢谢你。

That's right.这是正确的。 Once you got the token you should be fine, at least for Dropbox.获得令牌后,您应该没问题,至少对于 Dropbox 而言。 I think the Google Drive tokens have limited lifetimes.我认为 Google Drive 令牌的生命周期有限。 You need to use the refresh token which was returened together with your access token.您需要使用与访问令牌一起返回的刷新令牌。 By the way, you can use the cloudrail SDK to add both services via one API.顺便说一下,您可以使用cloudrail SDK 通过一个 API 添加这两种服务。 Should be much easier.应该容易多了。

As far as i know both of them are using OAuth 2.0 for verification and identification.据我所知,他们都使用 OAuth 2.0 进行验证和识别。 As you said, both of them require to call their activitys, but ONLY for the FIRST time.正如你所说,他们都需要调用他们的活动,但只是第一次。 Once the user allowed your application to access the desired service, you can get and save their tokens.一旦用户允许您的应用程序访问所需的服务,您就可以获取并保存他们的令牌。 After you have the token, you can login with it and do your task, without calling any 3rd party's Activity.获得令牌后,您可以使用它登录并完成您的任务,而无需调用任何 3rd 方的 Activity。
Refs: Dropbox Drive参考: Dropbox Drive

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM