如何使用深层链接而不是谷歌播放商店网站打开我的应用程序?

时间:2016-01-12 08:02:31

标签: android google-play deep-linking

我尝试直接打开我的应用,无需打开谷歌播放应用或浏览器应用,当用户点击引用我的谷歌播放页面的链接时。

我已尝试过此代码:

<intent-filter android:label="@string/filter_title_view_app_from_web">
    <action android:name="android.intent.action.VIEW" />

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

    <data
        android:host="play.google.com"
        android:scheme="https"
        android:path="/store/apps/details?id=my.package.name"/>
</intent-filter>

但它建议在没有我的应用的情况下使用Google Play或浏览器应用打开。

1 个答案:

答案 0 :(得分:0)

所以,这对我来说很棘手。 只需添加:

<intent-filter android:label="@string/filter_title_view_app_from_web">
    <action android:name="android.intent.action.VIEW" />

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

    <data
        android:host="my.site.name"
        android:scheme="http" />
</intent-filter>

并使用此按钮作为链接:

<a href="intent://my.site.name#Intent;scheme=http;package=my.package.name;end">  
    <img alt="Get it on Google Play" src="images/download_from_google_play_image.png">
</a>

如果该应用已安装,则会直接打开,否则会打开Goog​​le Play Market应用(这对我来说是一个惊喜......)。

相关问题