[Guide] Creating deep links with auto verify

Hello everyone :smiley:,
We are going to create deep links for our app.

Deep link

When a clicked link or programmatic request invokes a web URI intent, the Android system tries each of the following actions, in sequential order, until the request succeeds:

  1. Open the user’s preferred app that can handle the URI, if one is designated.
  2. Open the only available app that can handle the URI.
  3. Allow the user to select an app from a dialog

This is taken from Android documentation

Create a new project

In Designer

  • Add your package name e.g. com.thesocial.bus
  • Upload intent-filters.txt in Assets

intent-filters.txt (464 Bytes)

Inside intent-filters.txt

            <intent-filter android:autoVerify="true">
                <action android:name="android.intent.action.VIEW"/>
                <category android:name="android.intent.category.DEFAULT"/>
                <category android:name="android.intent.category.BROWSABLE"/>
                <data android:scheme="http" />
                <data android:scheme="https" />
                <data android:host="www.thesocialbus.com"/>
               // To accept more domain or subdomain. Just add a new data element
               // <data android:host="www.example.com"/>
            </intent-filter>

Basic information about above code

  • autoVerify - When `it’s true and present in your app’s intent filters, installing your app on a device that runs Android 6.0 (API level 23) or higher causes the system to automatically verify the hosts associated with the URLs in your app’s intent filters

  • scheme - You can add http, https and any custom text e.g. app.

  • host - You can add the domain which you want to verify e.g. www.thesocialbus.com

This is going to be added in your app’s AndroidManifest.xml (Screen1). So, Android will always open our app whenever https://www.thesocialbus.com or http://www.thesocialbus.com is clicked.

In Blocks

We have to use this block to get which url is clicked and redirected to your app. It is available in Screen’s properties.

component_method (7)

Complete blocks

Now, build your project once to get SHA-256 fingerprint generated.

Creating a deep link

Requirements

To create a deep link, You need :

  • A website’s link (We will use www.thesocialbus.com). Thanks to @Jay for his website.
  • A assetlinks.json file which must be uploaded at

https://domain.name/.well-known/assetlinks.json

Generating assetlinks.json file

It is required for auto verifying your domain in devices above Android 12.

Visit this site and generate the assetlinks.json file.

  • Hosting site domain - Enter your domain name e.g. www.thesocialbus.com

  • App package name - Enter app’s package name e.g. com.thesocialbus

  • App package fingerprint (SHA256) - Get it from Appzard workspace

    Click on Profile icon

    Screenshot (274)

    Click on Keystore Information

    Screenshot (275)

    Copy SHA-256 fingerprint

    Screenshot (276)

    After generating the statement list. Copy the generated statement and paste in assetlinks.json. Now, upload it at

    https://domain.name/.well-known/assetlinks.json

Building your project (APK)

Hurray :smiley: ! You have successfully added deep links in your project. Build your project and test it.

Testing

Tested on Android 12 and Android 9. working good for me :smiley:

Auto verify works too

FAQs

Q1. Why SHA-256 fingerprint is not visible ?
Ans. To generate SHA-256, you need to build the apk once

Q2. How can we accept all subdomains ?
Ans. If you want to accept all subdomains you have to use an asterisk (*) character before your host like this: *.example.com.

Q3. My domain don’t have www or any subdomain ? What to do ?
Ans. Add host without subdomain like this

<data android:host="example.com"/>

I tested it. And I was able to open my app but no start data was there.

Download links

Project file - Deeplink.aia (8.8 KB)
Test APK - Click me to download

Thanks :smiley:
Reply to this topic if you have any query

7 Likes

Very useful guide

5 Likes

How to create dynamic deeplink…
I mean if a user click on a video link in WhatsApp or any other app a pop up will show a list of apps which can play video there my video player app will show and when I click on it, my video player will play video…
Like we get in VLC or MX video player, they play any video with link

You can’t redirect all video links. Only the links which is verified in your app can be opened in your app.

So how this works in VLC media player and MX player, there I can play any video with link

1 Like
1 Like

Nice video @Xdev :wink:

@AryanGupta @Xdev
I got it, but my requirement is when a user clicks or open a url which is video it will show my app in list of available app which can run the video

I attached video below, there two different links when I clicked both of them VLC media player shows in pop up menu that VLC can run the video with both of the URL…
I want this type of deeplink system, is it possible in appzard

URL used in the video:-
Sample Video URLs- http://techslides.com/demos/sample-videos/small.mp4

http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4

I want deeplink system that supports multiple urls not only one which I specified in app

Use this code open specify URL

<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="http" />
    <data android:scheme="https" />
    <data android:host=" example.com" />
    <data android:host="www. example.com" />
</intent-filter>
2 Likes

Sample Video URLs- http://techslides.com/demos/sample-videos/small.mp4

<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="http" 
    android:scheme="https" 
    android:host="techslides.com" 
    android:host="www.techslides.com" 
    android:pathPrefix="/demos/sample-videos/small.mp4"/>
</intent-filter>
1 Like

I didn’t tested it but should work. It will accept only video links

<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:mimeType="video/*" /> 
</intent-filter>

Using Screen1.GetStartData, you can get the video link.

1 Like

@AryanGupta
Can you show blocks or send a sample aisa please :pleading_face:

I think @Xdev didn’t get me what I ask,
I just want to make deeplink system like vlc, MX player those apps can play any video URL, without specifying the url…
I want to make a video player app that can play any video with url, i don’t want to specify some urls to play with…
But @Xdev made only for specified URL , i posted sample links so that he can get what I want to do with…
@Xdev please read what I want to do, i want dynamic deeplink system not only for some urls, i want to show my video player app when user click on video link like in MX player, VLC player…

You should also keep some information, for more information I am sending you this link

1 Like

This one is not working, my video player app is not showing when I click on video link…
My aia:-
abb.aia (1.9 MB)

@AryanGupta Please check what I m doing wrong

@AryanGupta

I want my video player app to be shown here…
I want my app compatible with any video link…

Which android version are you using ?

Version-10

1 Like