如何在 c# Xamarin android 中从浏览器 link 打开应用程序?

How to open app from browser link in c# Xamarin android?

好吧,我在我的代码中尝试了一些示例,通过单击浏览器中的 link 打开应用程序,但我仍然无法在我的应用程序中执行我想要的操作。我想通过这些 links xamarin and this。任何人都可以建议我做什么,正确的方法来解决我的问题,提前谢谢。

我的代码:

[IntentFilter (new[]{Intent.ActionView}, 
 Categories = new [] {Intent.CategoryDefault}, 
 DataScheme = "superduperapp",
 DataHost = "something")]

link 例如:"superduperapp://my_code_is_here"

您可能缺少 CategoryBrowsable。试试这个:

[IntentFilter ( 
    new [] { Intent.ActionView }, 
    Categories = new [] { Intent.CategoryDefault, 
    Intent.CategoryBrowsable }, 
    DataScheme = "superduperapp", 
    DataHost = "my_code_is_here")]

此外,请记住,您可以通过 adb:

轻松测试您的意图
adb shell am start -a android.intent.action.VIEW -d superduperapp://my_code_is_here