Search code examples
androidgoogle-playdeep-linking

How to open my app with deep linking instead of google play store site?


I've tried to open my app directly, without opening google play app or browser app when user tap on the link which refers to my google play's page.

I've tried this code:

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

But it proposes to open with the Google Play or a Browser app, without my app.


Solution

  • So, this was tricky for me. Just add this:

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

    And use this button as a link:

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

    And if the app has already been installed, then the app will be opened. Otherwise, Google Play Market app will be opened (that was a surprise for me...).