Instant Apps: “You should have at least one active APK that is mapped to site 'sample.com' via a web 'intent-filter' ” when pushing to production

不打扰是莪最后的温柔 提交于 2019-12-04 19:32:13

The reason is because the behavior needs to be the same between the same track level of the installed and instant app. The user would experience a different URL resolving behavior if the user uses the installed-app (without the proper intent-filters) after downloading the instant app.

You have to add the app-link to your activity. Here's one example of what it looks like.

        <activity
        android:name=".GoodbyeActivity"
        android:label="@string/title_activity_goodbye"
        android:theme="@style/AppTheme">

        <intent-filter
            android:autoVerify="true"
            android:order="1">
            <action android:name="android.intent.action.VIEW" />

            <category android:name="android.intent.category.BROWSABLE" />
            <category android:name="android.intent.category.DEFAULT" />

            <data android:scheme="https" />
            <data android:scheme="http" />
            <data android:host="hello-flavors.instantappsample.com" />
            <data android:pathPrefix="/goodbye" />

        </intent-filter>

    </activity>

You can also use App link assistant tool to generate intent-filters. To open it Select Tools > App Links Assistant. For more details go to https://developer.android.com/studio/write/app-link-indexing.html

You need to define at least one default-url as the entry point to your app. I have defined it inside <activity> tag as below.

<activity .....>
            <meta-data
                android:name="default-url"
                android:value="https://www.example.com/home" />
</activity>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!