2016-01-12 66 views
2

我試圖直接打開我的應用程序,而不打開谷歌播放應用程序或瀏覽器應用程序時,用戶點擊鏈接,指的是我的谷歌播放頁面。如何用深度鏈接而不是谷歌播放商店網站來打開我的應用程序?

我試過這段代碼:

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

但它提出了與谷歌打開播放或瀏覽器應用程序,沒有我的應用程序。

回答

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> 

而且,如果應用程序已經安裝,然後將其直接打開,否則會打開谷歌播放Market應用程序(這是一個給我驚喜......)。

相關問題