简体   繁体   English

Android应用程序检查设备上的用户Dropbox帐户

[英]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.

相关问题 适用于Android的Dropbox Core API:如何检查设备上是否已安装drpbox官方应用 - Dropbox core api for android:how to check if drpbox official app in installed on device Android:检查用户设备上是否存在Facebook应用 - Android: Check to see if Facebook app is present on user's device 使用哪种Android意图在Dropbox应用中获取“保存到设备”行为? - Which Android intent to use to get the 'Save to device' behaviour in dropbox app? Android-Dropbox:检查差异 - Android - Dropbox: Check for differences 在Android设备上创建用户个人资料,就像我们在PC上拥有帐户一样 - Create user profiles on the android device like we have accounts on PC 在Android中更改Dropbox用户 - Change Dropbox User in Android Dropbox - Android - 如何在用户不知道他们使用Dropbox的情况下登录Dropbox? - Dropbox - Android - How to login to dropbox without the user knowing they are using Dropbox? 在 Android 应用程序中显示来自用户推特帐户的推文 - Displaying tweets from user's twitter accounts in an android app 如何将多个Google帐户添加到Android应用中,以便用户可以在多个帐户之间切换 - How to add multiple google accounts to an android app so that user can switch between accounts 如何检查应用程序在Android设备中的存在? - How to check the presence of app in android device?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM