Deep links that survive the installation process

  • Dynamic Links are smart URLs that allow you to send existing and potential users to any location within your iOS or Android app.
  • They survive the app install process, so even new users see the content they’re looking for when they open the app for the first time.
  • Dynamic Links are free forever, for any scale.
  • These are supported for Android, IOS, Web, and Unity.

Increase conversion for user-to-user sharing

  • When a user shares content from your app, the ultimate goal is to convert their friends and acquaintances into active native app users.
  • One of the most effective ways is to skip your generic onboarding and present personalized content when the app is first opened.
  • Using Dynamic Links makes the above-mentioned process easy.

Drive more installs through social, email, and SMS marketing campaigns

  • Promotional campaigns that include Dynamic Links, and platform-independently work for all users.
  • Users who open or install your app see the exact content your campaign is marketing.

Turn desktop users into mobile app users

  • Dynamic Links can help migrate users from your website to your mobile app.
  • Give them an easy way to send themselves a deep link that, when clicked on a mobile device, automatically opens in the right context within your app (even if they need to install the app first).

Now it’s time to see the steps for implementing Dynamic links in Your Firebase project and how to handle the links inside your Application.

Important Note:

- SHA 256 must be added to the Firebase Project.

Implementation of Dynamic Links

  • Connect your Android Studio Project to the Firebase.
  • Once the project is connected with the Firebase,  add the dynamic links SDK to your project file.
// Import the BoM for the Firebase platform
implementation platform('com.google.firebase:firebase-bom:28.3.0')

// When using the BoM, you don't specify versions in Firebase library dependencies
implementation 'com.google.firebase:firebase-dynamic-links'
  • Then open your firebase console and select dynamic links from the navigation bar.
  • Click “GET STARTED” in dynamic links.
Related :   Popular Facts to Make the Best Out of Google Play Store.
  • Add the URL prefix and the recommended Domain name in the application name, which should end with the page link.
  • For Example – appusage.page.link – here, I used app usage as the domain name, and it ends with .page.link.
  • Once the domain name is given, click continue, and at last, click finish.
  • After this process is done, the assetslinks.json file will be created automatically by the Firebase, which is not visible.
  • This assetslinks.json helps switch the link to the web browser, your application, or google play store of our application’s page based on the constraints.
  • Click New Dynamic Link.
  • In the First option, We have to set the Short URL link. We have the URL prefix default that we already created first.
  • There will be an option for adding the name at the end of the URL. So, you should add the name at the end.
  • Then click on the Next Button.
  • You will get the Deep link URL, where you should add a properly working URL with the parameters you want.
  • Here, I have used our company’s website URL and the parameter curPage= 2, which defines that when the dynamic link is clicked, the app should open and display its third page.
  • Give the name for the Dynamic Link and click Next.
  • Choose what should happen in IOS.
  • Select the behavior for Android by selecting the second option and the package name.
  • Select what needs to happen if the app is not installed.
  • Optionally, while sharing the links on Social Media to make the proper promotion, we can add the Previews so that the User knows something before he clicks it.
  • So, we can add the Preview title, the Preview image URL, and its description.
  • And, finally, Click on Save, and the Dynamic link will be ready.
Related :   Top Google searches list for India, US, and worldwide
  • As we have already mentioned, the assetlinks.json file won’t be visible. But, if you want to know what is in that json,  you can google below.


Your URL prefix/.well-known/assetlinks.json

Handling Dynamic Links

  • The dynamic links should be handled inside your Application.
  • For instance, we have added the parameters in the Deep link URL, like the app should show the third page of the Application.
  • According to the need, we should add <intent-filter> in Android Manifest.xml.
  • We need to do some code for getting the data from the Deep Link URL once the dynamic link is clicked.

Android Manifest.xml

<activity android:name=".ui.HomeActivity">
    <intent-filter>
            <action android:name="android.intent.action.VIEW"/>
               <category android:name="android.intent.category.DEFAULT"/>
               <category android:name="android.intent.category.BROWSABLE"/>
                // we have added both http and https to handle both the hosts.
                <data android:host="multivariate.tech" android:scheme="https"/>
                <data android:host="multivariate.tech" android:scheme="http"/>
            </intent-filter>
        </activity>

HomeActivity.java:

FirebaseDynamicLinks.getInstance().getDynamicLink(getIntent())
           .addOnSuccessListener(this,new OnSuccessListener<PendingDynamicLinkData>() 
{
            @Override
            public void onSuccess(@NonNull PendingDynamicLinkData pendingDynamicLinkData) {

                Log.e("HomeActivity","We have a Dynamic Link!");

                //initialize the Uri
                Uri deepLink = null;

                //check the result is null or not
                if(pendingDynamicLinkData != null)
                {
                    //from the task result get the deep link
                    deepLink = pendingDynamicLinkData.getLink();
                }

                //check deep link is null or not
                if(deepLink != null)
                {
                    Log.e("HomeActivity","Here's the deep link Url : \n" + deepLink.toString());

                    //get the value from the parameter
                    String currentPage = deepLink.getQueryParameter("curPage");

                    //convert to integer and set into viewPager.
                    int curPage = Integer.parseInt(currentPage);
                    
                    //This makes the app to display the page which is mentioned in the deep link parameter
                    viewPager.setCurrentItem(curPage);
                }

            }
        })
                .addOnFailureListener(this, new OnFailureListener() {
                    @Override
                    public void onFailure(@NonNull Exception e) {
                        Log.e("HomeActivity","Oops! we couldn't retrieved");
                    }
                });
            
  • The above code should be added to the activity which is declared as <intent-filter> in the AndroidManifest.xml
Related :   Best Instant Personal loan Apps Benefits and Features