Scan QR Code To Open Specific Content In An App

Consider an example. There is a science text book and the same publishers also have an Android app that has all the related information and much more. In a particular chapter of the book, there is a QR code. When this QR code is scanned, it should open the app and take the user to the related content on the app.

Another example is that of an app vendor who has a website to promote the app. In the Google search results when someone searches for a relevant keyword and comes to the website, easy access has to be given to the relevant content in the app. So, let us say the user clicks on a link in the mobile or scans a QR code on the website and has to be taken to some specific page in the app.

We can make use of the Dynamic Links feature to achieve this.

With Dynamic Links, you can seamlessly transition users from your mobile website to the equivalent content within your app. And because the links survive the app install process, even new users can pick up where they left off on your mobile site without skipping a beat.

QR Code Deep Links

Deep links let you redirect users to a specific destination inside your app which provides a better user experience.

A deep link is a URL that navigates to a specific destination in your app. When you click on a deep link, in Android:

  • Opens the user’s preferred app that can handle the link, if it’s available.
  • If the preferred app isn’t available, it opens the only app that can handle the link.
  • If multiple apps can handle the link, it opens a dialog that lets the user select from one of the apps that can open the link.
  • If the app is not installed it redirects to the app in Play Store.
  • https: Identifies the protocol used to access the resource on the internet.
  • The host, which is the name or address of the web server being accessed.
  • test: The path which specifies a particular page of content.
  • code: The query parameter you can extract from intents in your destination. abcd is the value of the parameter.

To add a deep link & use of this feature we have to add dynamic link support to the app.

You may want to check out the this blog to add dynamic link support to the app and the setup process.

If you are done with setup, add intent filters in the Android manifest file

Add an intent filter for deep links

You must add a new intent filter to the activity that handles deep links for your app.


The intent filter is required for your app to receive the Dynamic Link data after it is installed/updated from the Play Store and one taps on ‘Continue’ button. The intent filter catches deep links of your domain, since the Dynamic Link will redirect to your domain if your app is installed.

When users open a Dynamic Link with a deep link to the scheme and host you specify, your app will start the activity with this intent filter to handle the link.

Handle deep links

To receive the deep link, call the getDynamicLink() method:


You must call getDynamicLink() in every activity that might be launched by the link, even though the link might be available from the intent using getIntent().getData(). Calling getDynamicLink() retrieves the link and clears that data so it is only processed once by your app.

You normally call getDynamicLink() in the main activity as well as any activities launched by intent filters that match the link.

Consider this deep link URL as example.

Here in the above deep link url we are passing host and required parameters separated with ampersand to access a particular content directly without being following the normal app flow.

We will parse the and different parameters which we can use to do appropriate action (In this case we can use courseid, chapterid, subchapterid, contenttype and contentid and open the particular content on launch of the app) in side the app.

After accessing the deep link URL (created earlier while creating dynamic links using firebase console) on launch of app you can parse the URL so you can get your required parameters from it and can use your own execution to open the linked content.

An example of accessing linked content directly by launching the app. Here we have generated a QR code of the dynamic link. By scanning QR code we will launch the app and on the launch it will redirect to the linked content.

Click here to find out how Techpearl can build the best Mobile apps for you.

Read More Articles

 Contact Us Now

Talk to us to find out about our flexible engagement models.