首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >TWA地址栏未隐藏

TWA地址栏未隐藏
EN

Stack Overflow用户
提问于 2019-10-11 17:50:40
回答 2查看 372关注 0票数 2

我们正在尝试使用来自github存储库https://github.com/GoogleChromeLabs/svgomg-twa的代码通过我们的PWA推送到Android Play store。通过按照说明调试数字资产链接,我得到了这样的消息:

代码语言:javascript
复制
$ adb logcat | grep -e OriginVerifier -e digital_asset_links
10-11 08:37:29.701  5299  5299 I cr_OriginVerifier: Verification succeeded.

其中url栏在虚拟设备上被移除。

但是,当从Play商店下载的实际设备访问应用程序时,会显示url栏。此外,我已经从网址栏验证了PWA是“由Chrome提供支持的”。这一点已经在华为P20专业版和三星S8上得到了证实。

编辑:已添加build.gradle配置

代码语言:javascript
复制
apply plugin: 'com.android.application'

def twaManifest = [
    applicationId: 'health.tuli.portal',
    hostName: 'portal.tuli.health',
    launchUrl: '/',
    name: 'tuli.health',
    themeColor: '#522f81',
    backgroundColor: '#522f81',
    enableNotifications: true,
    useBrowserOnChromeOS: true
]

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId twaManifest.applicationId
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 6
        versionName "0.0.6"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

        resValue "string", "appName", twaManifest.name
        resValue "string", "launchUrl", "https://" + twaManifest.hostName + twaManifest.launchUrl
        resValue "string", "hostName", twaManifest.hostName
        resValue "string", "assetStatements",
                '[{ \\"relation\\": [\\"delegate_permission/common.handle_all_urls\\"],' +
                        '\\"target\\": {\\"namespace\\": \\"web\\", \\"site\\": \\"https://' +
                        twaManifest.hostName + '\\"}}]'

        resValue "color", "colorPrimary", twaManifest.themeColor
        resValue "color", "backgroundColor", twaManifest.backgroundColor
        resValue "string", "providerAuthority", twaManifest.applicationId + '.fileprovider'
        resValue "bool", "enableNotification", twaManifest.enableNotifications.toString()
        resValue "bool", "useBrowserOnChromeOS", twaManifest.useBrowserOnChromeOS.toString()
    }
    buildTypes {
        release {
            minifyEnabled true
            debuggable false
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.github.GoogleChrome.custom-tabs-client:customtabs:809a55cfa2'
}
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2020-01-21 01:21:08

因此,事实证明我没有在我的/.well-known/assetlinks.json文件中使用正确的sha256证书指纹(因为最初的说明导致我使用了错误的SHA256指纹)。我获得正确SHA256指纹的方法是从应用程序商店安装我的PWA,然后在同一设备上下载应用程序Asset Link Tool以找到我的包名,并使用我的/.well-known/assetlinks.json文件中提供的数字资产链接。

票数 3
EN

Stack Overflow用户

发布于 2019-10-11 19:36:50

在没有更多信息的情况下,很难确切地知道发生了什么。

有没有可能发生了重定向?例如:在launchUrl中使用的验证域是https://example.com,但是当打开该域时,用户会被重定向到https://www.example.com

如果可以将内容粘贴到应用程序的build.gradle中,这将很有帮助。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58338648

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档