有没有一种方法可以将Expo应用程序与Firebase动态链接集成在一起而不会分离? [英] Is there a way to integrate an Expo app with firebase dynamic links without detaching?
问题描述
有没有一种方法可以将Expo应用程序与firebase动态链接集成在一起而不会分离.
Is there a way to integrate an Expo app with firebase dynamic links without detaching.
推荐答案
If you need to create new dynamic links on the fly you could use REST API to do it. In the much more likely scenario that you only need your app to open Firebase's dynamic links, you don't need to do anything other than configuring your Expo App to handle universal links (ie: deeplinks using http/https).
清单是这样的:
对于Android,将 intentFilters
属性添加到您的 android
属性:
For Android, add the intentFilters
property to your android
property:
"android": {
"intentFilters": [
{
"action": "VIEW",
"data": [
{
"scheme": "https",
"host": "<your-domain>",
"pathPrefix": "/"
},
],
"category": [
"BROWSABLE",
"DEFAULT"
]
}
}
]
对于iOS,将 associatedDomains
属性添加到 ios
:
For iOS, add the associatedDomains
property to ios
:
"ios": {
"associatedDomains": ["applinks:<your-domain>"]
}
2.配置您的域以允许应用处理来自该域的链接
如果您从特定位置提供配置文件,则Android和iOS将允许您的应用打开您域中的链接:
2. Configure your domain to allow links from it to be handled by the apps
Android and iOS will allow your app to open links from your domain if you serve a configuration file from a specific location:
Android: https://<您的域>/.well-known/assetlinks.json
iOS: https://<您的域>/.well-known/apple-app-site-association
assetlinks.json
看起来像这样:
[{
"relation": ["delegate_permission/common.handle_all_urls"],
"target": {
"namespace": "android_app",
"package_name": "<android-package-name>",
"sha256_cert_fingerprints":
["<your-sha256-certificate-fingerprints>"]
}
}]
和 apple-app-site-association
一样:
{
"applinks": {
"apps": [],
"details": [
{
"appID": "<your-team-id>.<ios-bundle-identifier>",
"paths": [ "*" ]
}
]
}
}
要获取应用程序签名证书的SHA256指纹,您可以使用键盘工具:
To obtain the SHA256 fingerprints of your app’s signing certificate you can use the keytool:
keytool -list -v -keystore <your-key-file>
输入密钥库密码后,它将打印许多密钥库信息,包括SHA256指纹.
After you enter your keystore password, it will print many of the keystore information including the SHA256 fingerprints.
如果您的网站托管在Firebase上,并且在Firebase的项目上创建应用程序,则可以自动生成 assetlinks.json
和 apple-app-site-association
.否则,只需将这些文件放在您域的根目录上即可.
If your site is hosted on Firebase both assetlinks.json
and apple-app-site-association
can be generated automatically if you create the Apps on your Firebase's project. Otherwise, just put these files on the root of your domain.
我认为这主要是自我解释,只是一些注意事项:
I think this is step is mostly self explanatory but just a few notes:
- 设置您的简短URL链接:最后,您将/发送给用户
- 设置动态链接:在此处定义您的deelink(您希望应用处理的链接)
- 定义iOS的链接行为:您很可能希望单击在iOS应用中打开深层链接",然后从列表中选择您的应用(如果尚未创建,请为项目中的每个平台创建一个应用)
- 定义Android的链接行为:与以前相同,但还有更多选择可供选择
- 配置(或不配置)广告系列跟踪,您就完成了.
请记住,您始终应该通过单击而不是直接在浏览器上输入来测试深层链接.例如,您可以在WhatsApp上将链接发送给自己,也可以在某些笔记应用上放置链接.
其他可能有用的资源:
- https://docs.expo.io/versions/latest/workflow/linking/
- https://reactnavigation.org/docs/deep-linking/
这篇关于有没有一种方法可以将Expo应用程序与Firebase动态链接集成在一起而不会分离?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!