【问题标题】:TWA and external linksTWA 和外部链接
【发布时间】:2020-04-26 15:32:40
【问题描述】:

我想问一下是否有任何方法可以让 TWA(Trusted Web Authority) 应用程序在新的浏览器窗口而不是应用程序 webview 中打开外部链接,这些链接与 AndroidManifest.xml 中定义的主机不同?

我的 AndroidManiest.xml 看起来像这样:

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

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="${launcherName}"
        android:supportsRtl="true"
        android:theme="@style/Theme.TwaSplash">

        <meta-data
            android:name="asset_statements"
            android:value="${assetStatements}" />

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

            <meta-data
                android:name="android.support.customtabs.trusted.STATUS_BAR_COLOR"
                android:resource="@color/colorPrimary" />

            <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>
</manifest>

谢谢

【问题讨论】:

    标签: android progressive-web-apps external-links twa


    【解决方案1】:

    目前无法控制从 Android 应用打开链接的方式。

    但是,当在受信任的 Web 活动中打开外部链接时,它使用 Custom Tabs 而不是 WebView。这意味着使用用户的底层浏览器,它具有相同的网络平台功能并与独立浏览器共享存储(例如:cookie)。

    【讨论】:

      猜你喜欢
      • 2013-07-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-07-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多