DEV Community

Amit Tiwary
Amit Tiwary

Posted on • Edited on

How to handle the app link and deep link in android 12

Google has made some changes in Android 12 related to handle the app link or deep-link in the android. Our users on Android 12 were facing the issue that the links is open in the browser only, and they are not getting the option to open the app after clicking on the web link. After doing some research, we found that if we want to open the app when the user clicks on any links, then we need to verify the web link. Google uses the verification to identify that you are the owner of the website and android app.

So how can we verify the android app links? Android app links use the Digital Asset Links API to verifies that android app is approved to open links for that domain directly in the app. Here we are only going to discuss how can we solve the prolem that app link is not opening in the app directly. Open the play store developer console. Go to Setup and click on App integrity.

app integrity
There are two tabs 1. Integrity API 2. App signing. Click on App signing and scroll to bottom to section Digital Asset Links JSON.

DAL
Copy the JSON code. Add a public route, .well-known/assetlinks.json, to the website. Add the JSON code, that you copied from the play console, to this page. This page should eb accessible public so that google bot can scrape this page and verify that your app has been approved by the website to open links automatically. It can fix the issue for the new user that install the app but, the old user will still face this issue. There is some manual steps that user can follow and allow your app to open the link automatically in the app. Open the app settings and go to the app section. Click on app, and it opens a screen. Find default apps and click on it. On the next screen, you can see a option opening links. Click on it and it open a page where you can see list of apps. Find the app for which you want to verify the link and click on it. You will get the option to add supported links. Click on it, and you can see list of links that this app can open automatically. Click on the link, and now this app can automatically open this link in the app when user click on the link.

We faced the same issue with the deep link. When user click on the deep link then it open the play store, even if app installed. This is not the expected behaviour of deep link. When you click on deep link it check if there is any app to handle this link or not. If app present, it opens the app otherwise it redirect user to the play store. We are using the branch.io for the deep link generation. If you are also using the branch for the deep link generation then continue reading this blog. Open the branchio dashboad and go to the configuration. In the general tab, you will get the option to enable app links in the android redirects. You have the provide the SHA 256 key from the paly store console. It is the same SHA 256 key that we added in the asset link json. Save it. After that branch will handle the rest.

Top comments (0)