我们正在尝试使用此 github 存储库https://github.com/GoogleChromeLabs/svgomg-twa中的代码,使用 TWA 将 PWA 推送到 Android Play 商店。按照调试数字资产链接的说明,我收到以下消息:
$ 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 栏。此外,我已经从 url 栏中验证了 PWA 是“由 Chrome 提供支持”。这已在华为 P20 Pro 和三星 S8 上得到证实。
编辑:添加了 build.gradle 配置
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'
}