3

AndroidManifest.xml で定義されているものとは異なるホストを持つ外部リンクを開く TWA (Trusted Web Authority) アプリを、アプリの webview の代わりに新しいブラウザー ウィンドウで開く方法はありますか?

私の 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>

ありがとう

4

1 に答える 1

0

現在、Android アプリからリンクを開く方法を制御することはできません。

ただし、Trusted Web Activity で外部リンクを開くと、WebView ではなくカスタム タブが使用されます。これは、ユーザーの基盤となるブラウザーが使用されることを意味します。このブラウザーは、同じ Web プラットフォーム機能を持ち、ストレージ (Cookie など) をスタンドアロン ブラウザーと共有します。

于 2021-02-23T08:26:42.847 に答える