在Android应用程序中捕获customurlscheme? [英] Catching customurlscheme in android app?

查看:139
本文介绍了在Android应用程序中捕获customurlscheme?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前将CustomTabs/Native UI与Xamarin.Auth结合使用,以通过自定义Web API对Google的Android应用程序进行身份验证(我无法编辑/更改Web API).到达此网址后,是否可以拦截该网址(https)并返回到应用程序?还是由于chrome已经打开而无法用于自定义标签?

Currently using CustomTabs/Native UI with Xamarin.Auth to authenticate an Android application with Google through a custom web api ( I can not edit/change the web api). Is it possible to intercept a url (https) and return to the application once this url is reached? or will this not work with custom tabs due to chrome already being open?

意图过滤器的代码:

[
    IntentFilter
    (
        actions: new[] { Intent.ActionView },
        Categories = new[]
                {
                    Intent.CategoryDefault,
                    Intent.CategoryBrowsable
                },
        DataSchemes = new[]
                {
                    "https://redirectwebsite.com/"
                },
        DataPath = "https"
    )
]

推荐答案

解决方案: 我能够成功地导航回我的android应用并通过更改意图过滤器来获取令牌信息:

Solution: I was able to succussfully navigate back to my android app and grab the token information by changing my intent filter:

 [IntentFilter
    (
    actions: new[] { Intent.ActionView }, 
    Categories = new[] { Intent.CategoryDefault, Intent.CategoryBrowsable },
    DataSchemes = new[] { "https" }, 
    DataHost = "redirectwebsite.net",
    DataPath = "/", 
    AutoVerify = true
    )
]

这篇关于在Android应用程序中捕获customurlscheme?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆