Supporting same domain on two different apps supporting universal links..?

Related searches

I have an application which supports universal links and it is currently in the app store.

Say it supports the domain www.example.com and thus universal links can be easily opened via this. We will have applinks:www.example.com in associated domains.

Now say if I want to release another app and it also supports the same domain. Now how will iOS distinguish which app to open via universal links..?

In order to supporting Universal Links with single domain on two different apps you need to make changes in your existing apple-app-site-association file, at https://{domain}/apple-app-site-association.

For Single App Support

For single application support it's look like this

{
    "applinks": {
        "apps": [],
        "details": [
            {
                "appID": "1234ABCDE.com.domain.myapp",
                "paths": ["*"]
            }
        ]
    }
}
For Multiple App Support

For multiple application support, you need add one more key-value pair in details array of applinks in apple-app-site-association. It's look like this

{
    "applinks": {
        "apps": [],
        "details": [
            {
                "appID": "1234ABCDE.com.domain.myApp",
                "paths": ["*"]
            },
            {
                "appID": "1234ABCDE.com.domain.mySecondApp",
                "paths": ["*"]
            },
            {
                "appID": "1234ABCDE.com.domain.myThirdApp",
                "paths": ["*"]
            }
        ]
    }
}
General Format of apple-app-site-association file

The file looks like this:

{
"applinks": {
    "apps": [ ],
    "details": [
        {
            "appID": "{app_prefix}.{app_identifier}",
            "paths": [ "/path/to/content", "/path/to/other/*", "NOT /path/to/exclude" ]
        },
        {
            "appID": "TeamID.BundleID2",
            "paths": [ "*" ]
        }
    ]
}
}
References

How to support Universal Links in iOS App and setup server for it?

App Search Programming Guide: Support Universal Links, The problem is that two apps can claim the same URL scheme and there is no way The apple-app-site-association paths don't support regular expressions, but a universal link to a URL in a different domain, iOS opens the link in your app. Supporting Multiple Apps on the Same Domain. If two or more apps associate with the same content path on the website then the order of the appID, To support universal links in your app

I found the solution, its pretty simple though. My problem was that my first app was supporting all the pages by stating

"*" in the paths section of apple-app-site-association file. Now all I have to do is add NOT in front of one of the paths which I wanted my second app to handle.

like "NOT /cabs". I haven't tested it yet if this works or not. I will post an update as soon as I am done with it.

Allowing Apps and Websites to Link to Your Content, No, a collision is not possible. The way that app links and universal links work is. Your web page contains a URL to a file on your web server� Shared web credentials, universal links, and Handoff all use associated domains. Associated domains provide the underpinning to universal links, a feature that allows an app to present content in place of all or part of its website. Users who don’t download the app get the same information in a web browser instead of the native app.

Apple App Site Association file example

{
    "applinks": {
        "apps": [],
        "details": [{
            "appID": "D3KQX62K1A.com.example.photoapp",
            "paths": ["/albums"]
            },
            {
            "appID": "D3KQX62K1A.com.example.videoapp",
            "paths": ["/videos"]
        }]
    }
}

Important: The order of the dictionaries in the array determines the order the system follows when looking for a match. The first match wins, allowing you to designate one app to handle specified paths within your website, and another app to handle the rest.

References: https://developer.apple.com/documentation/uikit/core_app/allowing_apps_and_websites_to_link_to_your_content/enabling_universal_links

Universal Links, Apple introduced Universal Links in iOS 9 as a solution to the lack of graceful fallback You can support multiple apps on the same domain. If two or more apps associate with the same content path on the website then the� Each domain supported in the app needs to make available its own apple-app-site-association file. If the content served by each domain is different, then the contents of the file will also change to support the respective paths. Otherwise, the same file can be used, but it needs to be accessible at every supported domain.

Can more than one app claim a URL in Universal Links / App Links , This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site.

Universal links in iOS. Last day I was asked to integrate deep…, In other words, Apple Universal Links is a standard that can be applied to any link, and the best attribution & deep linking vendors support this standard. Known Problems with Apple Universal Links. Apple Universal Links is a useful technology that is proven to offer a better UX for users who have the app.

Universal Links for Developers. Seamlessly link to content inside your app, or on your website in iOS 9 or later. With universal links, you can always give users the most integrated mobile experience, even when your app isn’t installed on their device.

Comments
  • There is a problem with your implementation of your apple-app-site-association file. All your apps are supporting "*", meaning all your apps can handle all the pages of the domain. This way the last app installed will opened every time a universal link is clicked.
  • That's the reason for adding general format for apple-app-site-association
  • what about excluding subdomain instated of path?
  • Wow, you accepted your own answer rather than the actual answer. Your "answer" should be a comment on the actual answer.
  • @David If you look carefully I answered almost a month before Vineet's answer and I accepted my answer before as it was the correct solution to the actual problem.
  • You are quite right. The order of the answers (in active view) confused me, I was sure that I checked the dates too but obviously not. I'm sorry for the tone of my comment.
  • @David No problem :)
  • Thanks Ankit, It saved my time for the research