Talk to us
Talk to us
menu

Blog Post

start building
Developer

Grow Your Userbase With Invite Link

Grow Your Userbase With Invite Link

Nowadays, every company is trying to get more users for their apps. One of the most popular ways is to use a referral program. They give you an invite link which you can share with friends and acquaintances on social networks.
This article will show you how to implement generate invite link function in your app.

The invitation link will have the following capabilities:

  • Launch your app with an invite link.
  • Join a call or live stream via the invite link

Invitation process

invitation process

As shown in the figure, a complete invitation process is divided into four steps:

  1. User A generates an invitation link through your App and sends the invitation link to the invitees through Whatsapp, Facebook, Twitter, and other social networks.
  2. After User B receives the invitation link, he clicks the link to open it through the browser.
  3. The invite link page will request to open your application.
  4. After the application is launched, user B will automatically join the live streaming, video call, or online meeting.

Therefore, the key to implementing the invitation link is how to create a link that can not only launch your app but also automatically enter the live streaming, video call, or online meeting.

Launch your app with an invite link

If your application is a web application, it will be very simple. You only need to ensure that the invite link is your application link. Then you can open your web application through the invite link.

But if your app is an Android or iOS app, you need to use Android app links and iOS universal links to launch your app.

1. Launch an Android app with an invite link

Android App Links is a special deep link, which enables the Android system to open the application through the website address, without the user selection of Which application to use to handle website addresses.

To add Android App Links to your application, you need to define an intent filter in the application that opens the application through the HTTP (s) address. You need to verify that you actually own the application and the website. If the system successfully verifies that you own the website, the system routes the URL to your application.

In order to verify your ownership of apps and websites, the following two steps are required:

  • In the AndroidManifest, the system is required to automatically verify the ownership of App Links. This configuration tells the Android system to verify that your application belongs to the URL domain specified in the intent filter.
  • In the following link address, place a JSON file of the digital asset link to declare the relationship between your website and the application: https://domain.name/.well-known/assetlinks.json

For detailed operation steps, please refer to the official Android teaching video:

2. Launch an iOS app with an invite link

Universal Link is a feature launched by Apple in iOS9 that can conveniently launch APPs through HTTPS links.

If your app supports Universal Link, when users click a link, they can jump to your website and get redirected to the corresponding app, without going through the Safari browser. If your app doesn’t support it, the link will open in Safari.

Configuring Universal Link requires two settings:

  • App project settings.
  • Website configuration.

2.1 App project settings

You need to click in the Signing&Capabilities directory in your project, select Associated Domains, and then add your website domain name in Domains.

app project settings

2.2 Website Configuration

Create a new plain text file named apple-app-site-association without any suffix. The content of the file is:

{
    "applinks": {
        "apps": [],
        "details": [
            {
                "appID": "im.zegocloud.CallKitDemo",
                "paths": [ "/calldemo/*"]
            }
        ]
    }
}
parametervalue
appsKeep it as an empty array
appIDYour app bundle identifier
pathsIf you want to use the main domain name to open the application, you can fill in ” * “, if it is a subdirectory, you can fill in the corresponding directory, for example: “/calldemo/*”

Then upload this file to the root directory of the website, or create a subdirectory named .well-known in the root directory, and then upload this file to this subdirectory.

After completing the above steps, your application is configured with Universal Link. Use the configured URL to start your application.

Join the call or live stream via the invite link

After completing the previous steps, you can start your app through the invite link, but how to join the corresponding call or live streaming after the app is started?

ZEGOCLOUD’s UIKits will use roomID to identify all live streaming rooms or chat rooms, and you can join the specified live streaming room or chat room through roomID. So we only need to add the roomID parameter to the invitation link, and then each end can join the specified live room or call room by intercepting the roomID parameter on the URL.

Such as:

www.zegocloud.com/callkitdemo/?roomid=123321

Android:

Android can get the appLink through the getIntent or OnNewIntent callback method, so you only need to call the getIntent method in the onCreate method, and add the OnNewIntent method listener to get the invitation link and extract it roomID. Then you can join the corresponding live room or call room.

protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  ...
  handleIntent(getIntent());
}

protected void onNewIntent(Intent intent) {
  super.onNewIntent(intent);
  handleIntent(intent);
}

private void handleIntent(Intent intent) {
    String appLinkAction = intent.getAction();
    Uri appLinkData = intent.getData();
}

iOS:

If the application is started through universal links, the application: continueUserActivity: restorationHandler: method will be triggered. When activityType == NSUserActivityTypeBrowsingWeb, you can get the shared link through this method, and extract the roomID from it, then you can join the corresponding live room or call room.

func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
    if userActivity.activityType == NSUserActivityTypeBrowsingWeb {
        if let url = userActivity.webpageURL {
            print("Launch the app from a universal link",url.absoluteString)
        }
    }
    return true;
}

Conclusion

The invite link function is a convenient and effective way to attract new users to your application. It is also a great way to increase the number of active users on your app every day, which in turn helps you grow your user base. If you have an excellent product, then this function will help you increase the number of people who use it.

Read more

ZEGOCLOUD
ZEGOCLOUD With our fully customizable and easy-to-integrate Live SDK, you can quickly build reliable, scalable, and interactive live streaming into your mobile, web, and desktop apps.

Related posts