[英]Android app check for user Dropbox accounts on device
I am developing an app to download all the images from Dropbox. 我正在开发一个应用程序,用于从Dropbox下载所有图像。 I am using
Dropbox Core API
and have followed this example: Android Dropbox Core API official documentation 我正在使用
Dropbox Core API
,并遵循以下示例: Android Dropbox Core API官方文档
I would like to check if there are an account already opened on the device. 我想检查设备上是否已经开设了一个帐户。 In this case I want to get this session, otherwise I will build a new session with the
Dropbox Core API
. 在这种情况下,我想获得此会话,否则,我将使用
Dropbox Core API
构建一个新会话。 Is it that possible? 有可能吗
Thanks! 谢谢!
As noted in the tutorial you linked to, when using the Android Dropbox Core API, you can and should store and re-use the resulting access token for a user after they first authorize the app. 如您所链接的教程中所述,使用Android Dropbox Core API时,您可以并且应该在用户首次授权应用后为用户存储并重新使用由此产生的访问令牌。 (This is typically done using
SharedPreferences
.) (通常使用
SharedPreferences
完成此操作。)
On later runs of your app, your app should check wherever it stored the token to see if it has one. 在以后运行应用程序时,您的应用程序应检查其存储令牌的位置,以查看是否有令牌。 If it does, it can try to use that.
如果是这样,它可以尝试使用它。
If you do have an access token, you can construct an AndroidAuthSession
, eg, using this constructor: 如果您确实具有访问令牌,则可以使用以下构造函数构造一个
AndroidAuthSession
:
https://www.dropboxstatic.com/static/developers/dropbox-android-sdk-1.6.3-docs/com/dropbox/client2/android/AndroidAuthSession.html#AndroidAuthSession(com.dropbox.client2.session.AppKeyPair,%20java.lang.String) https://www.dropboxstatic.com/static/developers/dropbox-android-sdk-1.6.3-docs/com/dropbox/client2/android/AndroidAuthSession.html#AndroidAuthSession(com.dropbox.client2.session.AppKeyPair, %20java.lang.String)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.