deeplinking ios new en - adjust/cordova_sdk GitHub Wiki

Starting from iOS 9, Apple has introduced suppressed support for old style deep linking with custom URL schemes like described above in favour of universal links. If you want to support deep linking in your app for iOS 9 and higher, you need to add support for universal links handling.

First thing you need to do is to enable universal links for your app in the adjust dashboard. Instructions on how to do that can be found in our native iOS SDK README.

After you have enabled universal links handling for your app in your dashboard, you need to add support for it in your app as well. You can achieve this by adding this plugin to your cordova app. Please, read the README of this plugin, because it precisely describes what should be done in order to properly integrate it.

Note: You can disregard any information in the README that states that you need to have a domain and website or you need to upload a file to the root of your domain. Adjust is taking care of this instead of you and you can skip these parts of the README. Also, you don't need to follow the instructions of this plugin for the Android platform, because deep linking in Android is still being handled with Custom URL scheme plugin.

To complete the integration of Cordova Universal Links Plugin after successfully enabling universal links for your app in the adjust dashboard you must:

Edit your config.xml file

You need to add following entry to your config.xml file:

<widget>
    <universal-links>
        <host name="[hash].ulink.adjust.com" scheme="https">
            <path event="adjustDeepLinking" url="/ulink/*" />
        </host>
    </universal-links>
</widget>

You should replace the [hash] value with the value you generated on the adjust dashboard. You can name the event also how ever you like.

Check ul_web_hooks/ios/ content of the plugin

Go to the Cordova Universal Links Plugin install directory in your app and check the ul_web_hooks/ios/ folder content. In there, you should see a generated file with the name [hash].ulink.adjust.com#apple-app-site-association. The content of that file should look like this:

{
  "applinks": {
    "apps": [],
    "details": [
      {
        "appID": "<YOUR_TEAM_ID_FROM_MEMBER_CENTER>.com.adjust.example",
        "paths": [
          "/ulink/*"
        ]
      }
    ]
  }
}

Integrate plugin to your index.js file

After the deviceready event gets fired, you should subscribe to the event you have defined in your config.xml file, and define the callback method which gets fired once the event is triggered. Because you don't need this plugin to handle deep linking in Android, you can only need to subscribe to it if your app is running on an iOS device.

// ...

var app = {
    initialize: function() {
        this.bindEvents();
    },

    bindEvents: function() {
        document.addEventListener('deviceready', this.onDeviceReady, false);
    },

    onDeviceReady: function() {
        if (device.platform == "iOS") {
            universalLinks.subscribe('adjustDeepLinking', app.didLaunchAppFromLink);
        }
    },

    didLaunchAppFromLink: function(eventData) {
        // Check content of the eventData.url object and get information about the URL.
    }
}
// ...

By completing these steps, you have successfully added support for deep linking for iOS 9 and above as well.

⚠️ **GitHub.com Fallback** ⚠️