Thursday, October 1, 2020

How to enable Android App links in web-facing Sharepoint on-prem site

In previous article I showed how to enable universal links for iOS on Sharepoint on-prem site – see How to enable iOS universal links in web-facing Sharepoint on-prem site. In this post I will describe how to enable Android App links for web-facing Sharepoint on-prem site.

For Android App links the process is different. First of all we need to prepare special assetlinks.json file with predefined content:

[{
  "relation": ["delegate_permission/common.handle_all_urls"],
  "target": {
    "namespace": "...",
    "package_name": "...",
    "sha256_cert_fingerprints": ["..."]
  }
}]

I won’t describe here details about content of assetlinks.json file – you may find this information on Android documentation sites. Next step is to place assetlinks.json file into .well-known subfolder of the root folder of our site. On Sharepoint we can create this folder in site’s IIS folder C:\inetpub\wwwroot\wss\VirtualDirectories\{SiteName}.

After that we need to go to IIS manager > choose Sharepoint site > right click .well-known sub folder and click “Convert to Application”:

When .well-known subfolder is ready and configured in IIS manager we may copy assetlinks.json file there.

Now we need to make assetlinks.json file available for anonymous access (otherwise it won’t be available for Android infrastructure) and ensure that server adds Content-Type: "application/json" http header in response. In order to do that add the following web.config file to .well-known subfolder:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.web>
      <authorization>
        <allow users="*" />
      </authorization>
    </system.web>
    <system.webServer>
      <staticContent>
        <clear />
        <mimeMap fileExtension=".json" mimeType="application/json" />
      </staticContent>
        <handlers>
            <remove name="JSONHandlerFactory" />
        </handlers>
    </system.webServer>
</configuration>

After that Android App links will be available on your web-facing Sharepoint on-prem site.

No comments:

Post a Comment