Track the performance for In-App links using HUAWEI APP LINKING

RChancha
6 min readJul 2, 2021

Introduction

In-App linking is refer to App linking or deep linking in general, however it is particularly for the use case of sharing content with the same application for the same application installed on the android device.

Huawei App Linking leverage developers/users to create cross platform links which can work as defined and can be distributed with multiple channels to users.

When the user clicks the link, it will be re-directed to the specified in-app content.

Huawei App Linking has multiple functions:

1. Support for deferred deep links

2. Link display in card form

3. Data statistics

Huawei App Linking supports the link creation in multiple ways:

1. Creating a link in AppGallery Connect

2. Creating a link by calling APIs on the client

3. Manually constructing a link

Creating a link in AppGallery Connect

We will be focusing on the Huawei App linking capabilities to create the deep links for our Android application through Huawei AppGallery Connect.

Use Case

There could be multiple use cases for this capability, however I will throw some light on a use case which is most commonly adapted by the applications with complex UX and high transmission between different in-app pages.

Development Overview

1. Must have a Huawei Developer Account

2. Must have Android Studio 3.0 or later

3. Must have a Huawei phone with HMS Core 4.0.2.300 or later

4. EMUI 3.0 or later

Software Requirements

1. Java SDK 1.7 or later

2. Android 5.0 or later

Preparation

1. Create an app or project in Android Studio.

2. Create an app and project in the Huawei AppGallery Connect.

3. Provide the SHA Key and App Package name of the project for which you want the App Linking to be done (Example: News application)

4. Download the agconnect-services.json file and paste to the app folder of your android studio.

Integration

  • Add below to build.gradle (project)file, under buildscript/repositories and allprojects/repositories.
  • Add below to build.gradle (app) file, under dependencies to use the App Linking SDK.

News Application

News application is developed with multiple content and complex UX to show the capability of the Huawei App Linking.

I will highlight some if the important code blocks for this application.

Main Activity

This activity is the entry point for the application which will have the navigation tab to handle the multiple news categories.

Also, it receives the App Link, read it and re-direct it to the corresponding content.

Creating a link in AppGallery Connect to directly open the Science tab for the News Application through a link

1. Login to AppGallery Connect.

2. Choose My Projects > NewsWorld(App Linking).

3. Go to>Growing > App Linking>Enable now

4. Once you enable the app linking for your project by setting up the country and region choose URL prefix>Add URL prefix

Add URL prefix, which is a free domain name provided by AppGallery Connect with a string.

Tip: URL prefix should be unique and can contain only lowercase letters and digits.

Select Set domain name option and then click on Next button.

The following page will be displayed.

6. Click App Linking and then click Create App Linking for deep linking purpose. It is required to directly navigate to specific in-app content from a different application.

7. It will suggest short link by itself or you can customise it as shown below.

8. Click on Next button and set the deep link.

App Linking name: deep link name.

Default deep link: deep link used to open an app.

Android deep link: deep link preferentially opened on an Android device.

iOS deep Link URL: deep link preferentially opened on an iOS device.

Tip 1: Link name and Default deep link can be same and follow as https://domainname.com/xxx

Where “domainname” is URLprefix which we set above and “xxx” is specific in-app content page to re-direct.

Tip 2: You can customize the deep link, which is different from the URL prefix of the link.

Once done, click on Next button.

9. Select Set Android link behaviour for your Android application as below.

We will choose “Open in app” as we want our application to open directly as application.

Select your application from the Add Android app menu.

Redirect user to AppGallery page if the application is not installed on the device.

Tip: Ensure that the App Store ID and team ID have been configured. If they are not configured, add them as prompted.

Once done, click on Next button.

10. We have set the deep link for our news application and it will re-direct to in-app content tab (science) every time when it is shared from our share application.

To check the details and use the link we will navigate to view details

11. We will use short App link for our App Linking use case. It will re-direct the user to Science tab of news application from our shared link through different tab.

Receiving Links of App Linking

When a user is directed to the target content after tapping a received link of App Linking, your app can call the API provided by the App Linking SDK to receive the tapped link and obtain data passed through the link.

Add an Intent Filter to manifest file

Add intent filter to activity which will receive and process the link.

We will add this for Main activity for our use case.

Receive the link in our Main activity

Add below code to your activity to receive and process the link.

Check Statistics for your links

Huawei App Linking provides lot many additional features to track the statistic for the created in-app links for your application which will be helpful in order to generate the analytical reports and improve the performance.

Step 1: Click on Statistics

Step 2: Check the performance graph based on the filters

Results

Tips and Tricks

1. URL prefix should be unique and can contain only lowercase letters and digits.

2. Link name and Default deep link can be same and follow as https://domainname.com/xxx

Where “domainname” is URLprefix which we set above and “xxx” is specific in-app content page to re-direct.

3. You can customize the deep link, which is different from the URL prefix of the link.

4. Ensure that the App Store ID and team ID have been configured. If they are not configured, add them as prompted.

Conclusion

This article focuses explains how in-app links can be created using Huawei App Linking capabilities and use them further for in –app content re-directions for large scale android applications. This article also explains how one can check the statistics for their app links.

Reference

https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-applinking-introduction

--

--