Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/xamarin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Xamarin Android启动应用程序使用带参数的链接_C#_Xamarin_Android Intent_Xamarin.android_Intentfilter - Fatal编程技术网

C# Xamarin Android启动应用程序使用带参数的链接

C# Xamarin Android启动应用程序使用带参数的链接,c#,xamarin,android-intent,xamarin.android,intentfilter,C#,Xamarin,Android Intent,Xamarin.android,Intentfilter,我有个问题。我创建了一个IntentFilter,以便在单击特定链接时启动我的应用程序。这是我的意向过滤器: [IntentFilter(new[] { Intent.ActionView }, Categories = new[] { Intent.CategoryDefault, Android.Content.Intent.CategoryBrowsable }, DataScheme = "myapplication.app" )] 以下是链接: <a href='myappli

我有个问题。我创建了一个IntentFilter,以便在单击特定链接时启动我的应用程序。这是我的意向过滤器:

[IntentFilter(new[] { Intent.ActionView },
Categories = new[] { Intent.CategoryDefault, Android.Content.Intent.CategoryBrowsable },
DataScheme = "myapplication.app"
)]
以下是链接:

<a href='myapplication.app://'>here</a>


但是如何在该链接中传递参数(整数)以及如何在C代码中使用该参数?

完整的URL方案协议格式包括方案、主机、端口、路径和查询。结构如下:

<scheme>://<host>:<port>/<path>?<query>
链接:

<a href="urlschemetest2://testurl.com/?firstname=john&lastname=doe">Test Opening App</a>

我需要把代码放在哪里才能得到uri参数?它现在可以工作了吗?
<a href="urlschemetest2://testurl.com/?firstname=john&lastname=doe">Test Opening App</a>
 protected override void OnNewIntent(Intent intent)
 {
   Android.Net.Uri uri  = Intent.Data;
   if(uri != null)
   {
      string firstName = uri.GetQueryParameter("firstname");
      string lastName = uri.GetQueryParameter("lastname");
   }
   base.OnNewIntent(intent);
 }