从应用程序在浏览器上打开登录页面后导航回应用程序

问题描述 投票:0回答:1

我想使用登录网址登录我的用户,可以选择使用谷歌登录。使用谷歌登录后,我希望我的用户返回到应用程序,并通过登录成功或失败的回调来更改应用程序行为[![在此处输入图像描述][1]][1]

作为参考,您可以查看 NordVpn 登录功能

https://play.google.com/store/apps/details?id=com.nordvpn.android

java android kotlin google-oauth deep-linking
1个回答
0
投票

要实现这一点,您需要实现如下所示的深层链接

android:scheme
这个键很重要,scheme 不应该有 https://,因为它的行为是在 Android 设备中查找浏览器应用程序,scheme 应该仅对您的应用程序是唯一的(考虑使用 appName),并且 webapp 应该导航到 url喜欢
randomApp://openApp......

 <activity
            android:name=".ui.activity.DeepLinkingActivity"
            android:exported="true">

            <intent-filter android:autoVerify="true">
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="randomApp" />
            </intent-filter>

        </activity>

下面是来自有关深层链接的 Android 文档的参考图片 (https://developer.android.com/training/app-links/deep-linking) 应用程序方案仅对我们的应用程序是唯一的,不应被其他应用程序使用

注意:如果两个应用程序使用相同的方案值,则 Android 将为用户提供选择,用户可以选择他们想要导航的应用程序

© www.soinside.com 2019 - 2024. All rights reserved.