3 c# xamarin.ios xamarin.android xamarin xamarin.forms
我有个问题。我想从我的 php 页面启动我的应用程序并通过该链接传递一个变量。然后在我的应用程序网站上,我需要读取参数并使用该参数执行我想要的操作。现在我已经找到了这个链接:Xamarin Android Start app using link withparameters。这个人用 来做到这一点Xamarin.Android。但我怎样才能在 中做到这一点Xamarin.Forms,或者它是否相似?
我将使用以下网址作为示例向您展示如何执行此操作: https: //xamboy.com/hello/Rendy
\n\n首先,您需要为每个平台配置应用程序链接支持。通过执行以下步骤:
\n\n为了验证域与应用程序的关联,需要在定义该关联的网站中上传文件。
\n\n需要创建一个名为 apple-app-site-association.xml 的文件。该文件应包含以下 json 结构:
\n\n{\n "applinks": {\n "apps": [],\n "details": [\n {\n "appID": "CNAL8C4H5U.com.crossgeeks.applinkssample",\n "paths": [ "/hello/*"]\n }\n ]\n }\n}\nRun Code Online (Sandbox Code Playgroud)\n\n示例: https: //www.xamboy.com/.well-known/apple-app-site-association
\n\n该文件应放置在 .well-known 文件夹内或网站的根路径 ( https://yourdomain/.well-known/apple-app-site-association )。
\n\nPaths 是我们的应用程序将处理的所有路径(如果出现在 url 上)的定义。例如,在我们的例子中是https://xamboy.com/hello,因为我们刚刚将 /hello 定义为 apple-app-site-association 文件中的路径。
需要创建一个名为 assetlinks.json 的数字资产文件。\xe2\x80\x99 是一个在线工具,可帮助您在此处创建和测试此文件: https: //developers.google.com/digital-asset-links/tools/generator。
\n\n它应该包含以下 json 结构:
\n\n[\n {\n "relation":[\n "delegate_permission/common.handle_all_urls"\n ],\n "target":{\n "namespace":"android_app",\n "package_name":"com.crossgeeks.applinkssample",\n "sha256_cert_fingerprints":[\n "3E:5D:E5:3B:BC:5A:61:BC:9E:96:34:C7:C2:D6:9F:BB:32:3C:8E:C5:FD:CE:D2:76:4C:81:98:2F:41:12:15:DD"\n ]\n }\n }\n]\nRun Code Online (Sandbox Code Playgroud)\n\n示例: https: //www.xamboy.com/.well-known/assetlinks.json \xef\xbb\xbf
\n\n该文件应放置在网站的 .well-known 文件夹中 ( https://yourdomain/.well-known/assetlinks.json )。
\n\n如果您想测试一切是否正常,可以使用以下网址来完成:
\n\nhttps://digitalassetlinks.googleapis.com/v1/statements:list?source.web.site= https://:&relation=delegate_permission/common.handle_all_urls
\n\n如果一切正常,它应该看起来类似于:
\n\n\n\n转到 Entitlements.plist 文件,启用关联域属性并添加网站的域,格式为 applinks:yourdomain.com 和 applinks:*.yourdomain.com
\n\n\n\n通过为您想要支持的每个域/路径/协议添加 IntentFilter,在 Android MainActivity 上配置应用程序链接。
\n\n{\n "applinks": {\n "apps": [],\n "details": [\n {\n "appID": "CNAL8C4H5U.com.crossgeeks.applinkssample",\n "paths": [ "/hello/*"]\n }\n ]\n }\n}\nRun Code Online (Sandbox Code Playgroud)\n\n在 App.cs 文件中重写方法 OnAppLinkRequestReceived。您可以在此处处理通过应用程序链接打开应用程序时发生的情况并处理参数:
\n\n[\n {\n "relation":[\n "delegate_permission/common.handle_all_urls"\n ],\n "target":{\n "namespace":"android_app",\n "package_name":"com.crossgeeks.applinkssample",\n "sha256_cert_fingerprints":[\n "3E:5D:E5:3B:BC:5A:61:BC:9E:96:34:C7:C2:D6:9F:BB:32:3C:8E:C5:FD:CE:D2:76:4C:81:98:2F:41:12:15:DD"\n ]\n }\n }\n]\nRun Code Online (Sandbox Code Playgroud)\n\n\n
| 归档时间: |
|
| 查看次数: |
3998 次 |
| 最近记录: |