Skip to main content
 首页 » 编程设计

c#之如何从 c# Xamarin android 中的浏览器链接打开应用程序

2024年02月06日12jackei

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

我的代码:

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

链接例如:“superduperapp://my_code_is_here”

请您参考如下方法:

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

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

此外,请记住,您可以通过 adb 轻松测试您的 Intent :

adb shell am start -a android.intent.action.VIEW -d superduperapp://my_code_is_here