Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 在受信任的Web活动中,地址栏未隐藏_Android_Url_Google Play_Progressive Web Apps_Trusted Web Activity - Fatal编程技术网

Android 在受信任的Web活动中,地址栏未隐藏

Android 在受信任的Web活动中,地址栏未隐藏,android,url,google-play,progressive-web-apps,trusted-web-activity,Android,Url,Google Play,Progressive Web Apps,Trusted Web Activity,在阅读了关于TWA的页面并隐藏了URL栏之后,我按照所有说明隐藏了URL栏,但令人惊讶的是,它没有被隐藏 我怎样才能解决这个问题 这是我的assetlinks.json文件: [{ "relation": ["delegate_permission/common.handle_all_urls"], "target": { "namespace": "android_app", "package_name": "org.foodeye.mobile", "sha2

在阅读了关于TWA的页面并隐藏了URL栏之后,我按照所有说明隐藏了URL栏,但令人惊讶的是,它没有被隐藏

我怎样才能解决这个问题

这是我的assetlinks.json文件:

[{
  "relation": ["delegate_permission/common.handle_all_urls"],
  "target": {
    "namespace": "android_app",
    "package_name": "org.foodeye.mobile",
    "sha256_cert_fingerprints":
    ["BA:D3:3B:41:7C:1E:7B:DC:0F:FE:70:EB:33:5D:F1:A0:40:3B:09:73:A0:5D:42:80:45:DA:CB:DA:0F:9D:5A:D3"]
  }
}]
这是assetlinks.json url:

这是舱单:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.foodeye.mobile">

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <meta-data
        android:name="asset_statements"
        android:value="@string/asset_statements" />

    <activity android:name="android.support.customtabs.trusted.LauncherActivity"
        android:label="${launcherName}">
        <meta-data android:name="android.support.customtabs.trusted.DEFAULT_URL"
            android:value="${defaultUrl}" />

        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>

        <intent-filter>
            <action android:name="android.intent.action.VIEW"/>
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE"/>
            <data android:scheme="https"
                android:host="${hostName}"/>
        </intent-filter>
    </activity>
</application>
这是strings.xml:

<resources>
<string name="app_name">Food Eye</string>
<string name="asset_statements">
    [{
        \"relation\": [\"delegate_permission/common.handle_all_urls\"],
        \"target\": {
            \"namespace\": \"web\",
            \"site\": \"https://app.foodeye.org\"}
    }]
</string>

食物眼
[{
\“关系\:[\“委托权限/公用。处理所有URL\”,
\“目标\”:{
\“名称空间\”:“web\”,
\“站点\:\”https://app.foodeye.org\"}
}]


提前感谢。

您在TWA中打开的URL似乎是
https://app.foodeye.org
,但AssetLink托管在
https://foodeye.org/.well-known/assetlinks.json
,它是另一个原点


您需要将a AssetLink文件托管在与您在TWA中打开的URL相同的源上<代码>https://app.foodeye.org/.well-known/assetlinks.json

当我从浏览器访问assetlinks.json内容时,我会得到下面呈现的内容:。在浏览器中使用curl或fetch返回正确的JSON,但我怀疑在浏览器尝试运行验证时是否返回了错误的内容。我使用的是Django REST Framework生成的可浏览API。现在我已经将其转换为自然JSON格式。不过,它还是不起作用
<resources>
<string name="app_name">Food Eye</string>
<string name="asset_statements">
    [{
        \"relation\": [\"delegate_permission/common.handle_all_urls\"],
        \"target\": {
            \"namespace\": \"web\",
            \"site\": \"https://app.foodeye.org\"}
    }]
</string>