问题
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:
- 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