Catching customurlscheme in android app?

自闭症网瘾萝莉.ら 提交于 2019-12-25 09:00:00

问题


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?

Code for Intent Filter:

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

回答1:


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
    )
]



回答2:


Brian don't we communicate on community slack?

Please save my butt. Context switching between slack (3 teams), forums, SO and github is kicking my butt all over the place and I'm not i7.

You have bunch errors in your code posted:

  1. this is not DataScheme, but URL/URI/URN in DataScheme for this case it should be https only. But for native ui this is not right, because you need custom scheme.

"https://redirectwebsite.com/"

Yes there are tutorials where you can use http[s] on Android for deep linking (app linking), but I was not able to do it.

Please make minimal sample and make me happy to (to learn something).



来源:https://stackoverflow.com/questions/44264732/catching-customurlscheme-in-android-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!