如何识别它是否是 Dropbox 授权?

How to identificate if it's a Dropbox auth?

我打算在我的应用中使用不同的存储类型。我从 Dropbox 开始。它有有用的方法,可以进入意图,授权用户,并且 returns 到最后 activity:

String key = settings.getString ("dropbox_key", "");
Auth.startOAuth2Authentication (SettingsActivity.this, key);

我可以使用 activity 中的 onResume () 方法处理它的数据,但是我如何确定我是通过 Dropbox auth 返回给它的,而不是 Google 和其他 Oauth 应用程序,因为我想在一个 activity 中使用它,但是获取不同的数据并将其写入不同的设置值。我认为它将是一种 BROWSABLE 类别类型 activity,由 URL 打开,Dropbox 将其用作回调并将必要的参数传递给它,但我试图通过 [=13] 获取其数据=],但它总是为空。

Dropbox activity 使用他们的默认代码连接,所以我无法传递我自己的 activity uri:

     <activity
        android:name="com.dropbox.core.android.AuthActivity"
        android:configChanges="orientation|keyboard"
        android:launchMode="singleTask"
        android:theme="@android:style/Theme.Translucent.NoTitleBar"
    >
        <intent-filter>

            <data android:scheme="db-xxxxxxxxxxx"/>

            <action android:name="android.intent.action.VIEW"/>

            <category android:name="android.intent.category.BROWSABLE"/>
            <category android:name="android.intent.category.DEFAULT"/>

        </intent-filter>

    </activity>

提前致谢。

如果您使用的是 Dropbox API v2 Java SDK in an Android app, you should be handling the end of the app authorization flow in your onResume as shown in the example app

您可以并使用 Auth.getOAuth2Token 的 return 值来检查用户是否从 Dropbox 应用程序授权流程返回。也就是说,如果 return 值不为空,则它是访问令牌 return 作为 Dropbox 应用程序授权流程的结果。

如果为空,则表示用户不会由于 Dropbox 应用程序授权流程而返回应用程序。