使用 openid / AppAuth-Android 的重定向 URI 中的多实例

问题描述

当我使用这个库时: https://github.com/openid/AppAuth-Android

在尝试使用深层链接和打开应用程序时遇到问题。在这种情况下,我的应用程序有一个具有相同名称和包名称的多实例。我只想举一个例子。 (当我触摸其中一个实例时会发生重定向,但触摸另一个实例时什么也没有发生)

一切正常,只有我有这个问题。 我也看到了这些问题:

https://github.com/openid/AppAuth-Android/issues/329

https://github.com/openid/AppAuth-Android/issues/481

https://github.com/openid/AppAuth-Android/issues/491

这是我在清单中的代码

<activity
            android:name=".util.deeplink.appAuth.RedirectUriReceiverActivity"
            tools:node="replace">
            <intent-filter>
                <action android:name="android.intent.action.VIEW"/>
                <category android:name="android.intent.category.DEFAULT"/>
                <category android:name="android.intent.category.broWSABLE"/>
                <data android:scheme="test"
                    android:host="ops" />
            </intent-filter>
        </activity>

解决方法

我们找到了解决方案。我们只需要添加

<activity android:name="net.openid.appauth.RedirectUriReceiverActivity"
            tools:node="replace"/>

除了我们的自定义类:

<activity
            android:name=".util.deeplink.appAuth.RedirectUriReceiverActivity"
            android:windowSoftInputMode="stateAlwaysHidden">

进入清单文件