我在android react native中设置了一个深度链接。我想在点击链接时跳过选项菜单,为此我添加了以下内容 .well-known/assetlinks.json
文件在我的域名地址上,当我使用验证时,我看不到任何错误。这个,没有显示错误。
assetlinks.json
文件。
[{
"relation": ["delegate_permission/common.handle_all_urls"],
"target": {
"namespace": "android_app",
"package_name": "<package-name>",
"sha256_cert_fingerprints": [<SHA>]
}
}]
digitalassetlinks的响应
{
"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:
AndroidManifest.MainActivity.java
<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的推荐练习,效果还不错。
有趣的是,我知道域名应该包括wwwSo,以前当我尝试与xyz.com它不工作与上述配置和当我改变域名在Android清单www.xyz.com,它的工作。
但是,我仍然不知道为什么它的工作为www。