Go to console

Receive Dynamic Links with C++

To receive the Firebase Dynamic Links that you created, you must include the Dynamic Links SDK in your app and create a firebase::dynamic_links::Listener object that implements the OnDynamicLinkReceived virtual function.

The C++ SDK works for both Android and iOS, with some additional setup required for each platform.

Before you begin

Before you can use Firebase Dynamic Links, you need to:






Add custom URL schemes (for iOS only)

The Firebase Dynamic Links C++ client library uses custom URL schemes on iOS to process links. You must add custom URL schemes to your app to support receiving Dynamic Links.

  1. To open your project configuration, double-click the project name in the left tree view.

  2. Select your app from the TARGETS section, then select the Info tab, then expand the URL Types section.

  3. Click the + button, then add a URL scheme for your reversed client ID. To find this value:

    1. Open the GoogleService-Info.plist configuration file, then look for the REVERSED_CLIENT_ID key.

    2. Copy the value of that key, then paste it into the URL Schemes box on the configuration page.

    3. Leave the other fields blank.

  4. Click the + button, then add a second URL scheme. This one is the same as your app's bundle ID.

    For example, if your bundle ID is com.example.ios, type that value into the URL Schemes box.

    You can find your app's bundle ID in the General tab of the project configuration (Identity > Bundle Identifier).

Receiving a Dynamic Link

Create and initialize App

Before you can check for received Dynamic Links, you'll need to create and initialize a firebase::App object.

Include the header file for firebase::App:

#include "firebase/app.h"

The next part varies depending on your platform:





Create the firebase::App:


Implement Listener to check for Dynamic Links

To check for a received Dynamic Link, implement and use the firebase::dynamic_links::Listener class.

Include the header file for receiving Dynamic Links:

#include "firebase/dynamic_links.h"

Initialize the Dynamic Links library:

::firebase::dynamic_links::Initialize(app, null);

Create an object that implements firebase::dynamic_links::Listener, and supply it to the Dynamic Links library with SetListener(), or pass it as the second argument to Initialize.

To receive Dynamic Links, your Listener class must implement the OnDynamicLinkReceived virtual function. By overriding the method, you can receive a deep link, if one was received.

class Listener : public firebase::dynamic_links::Listener {
  // Called on the client when a dynamic link arrives.
  void OnDynamicLinkReceived(
      const firebase::dynamic_links::DynamicLink* dynamic_link) override {
    printf("Received link: %s", dynamic_link->url.c_str());