android - 深层链接在 android react native 中不起作用
问题描述
我已经在 android react native 中设置了一个深层链接。单击链接时,我想跳过选项菜单,因为我已经.well-known/assetlinks.json
在我的域地址上添加了文件。当我使用this进行验证时,我看不到任何错误
,没有显示错误。
assetlinks.json
文件:
[{
"relation": ["delegate_permission/common.handle_all_urls"],
"target": {
"namespace": "android_app",
"package_name": "<package-name>",
"sha256_cert_fingerprints": [<SHA>]
}
}]
数字资产链接的响应
{
"statements": [
{
"source": {
"web": {
"site": "<domain>."
}
},
"relation": "delegate_permission/common.handle_all_urls",
"target": {
"androidApp": {
"packageName": "<package-name>",
"certificate": {
"sha256Fingerprint": "<SHA>"
}
}
}
}
],
"maxAge": "59.999586063s",
"debugString": "********************* ERRORS
*********************\nNone!\n********************* INFO MESSAGES *********************\n*
Info: The following statements were considered when processing the request:\n\n---\nSource:
安卓清单:
<intent-filter android:label="@string/app_name" android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" android:host="domain" />
<data android:scheme="https" />
</intent-filter>
MainActivity.java
public class MainActivity extends ReactActivity {
/**
* Returns the name of the main component registered from JavaScript.
* This is used to schedule rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "<package-name>";
}
@Override
protected ReactActivityDelegate createReactActivityDelegate() {
return new ReactActivityDelegate(this, getMainComponentName()) {
@Override
protected ReactRootView createRootView() {
return new RNGestureHandlerEnabledRootView(MainActivity.this);
}
};
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// ATTENTION: This was auto-generated to handle app links.
Intent appLinkIntent = getIntent();
String appLinkAction = appLinkIntent.getAction();
Uri appLinkData = appLinkIntent.getData();
}
}
仅供参考:IOS 推荐的练习是什么时候做的,效果很好。
解决方案
有趣的是,我知道域名应该包含 www 所以,以前当我尝试使用 xyz.com 时,它不适用于上述配置,而当我将 Android 清单中的域更改为 www.xyz.com 时,它起作用了。
但是,我仍然不知道为什么它适用于 www。
推荐阅读
- java - BasicNetwork.performRequest:意外的响应代码 413?
- javascript - 在同步 Safari 中播放多个 html5 音频文件 (mp3)
- ubuntu - 新鲜的 ubuntu 设置 Golang + dep,dep 确保不做任何事情
- php - 将自定义数据添加到 Woocommerce 订单项目
- java - 无法创建在后台运行的 Android 应用程序
- microsoft-graph-api - 微软图表中带有坐标的站点或房间列表
- database-connection - Tomcat jdbc 连接池 - 删除放弃后未创建空闲连接
- asp.net-mvc - 在 MVC Core 应用程序中创建母版页
- angularjs - 未知提供者:uiCropperProvider <- uiCropper
- php - Laravel 检查状态并发送电子邮件