C# Xamarin Android启动应用程序使用带参数的链接
我有个问题。我创建了一个IntentFilter,以便在单击特定链接时启动我的应用程序。这是我的意向过滤器: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(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);
}