# HealthChat Android deeplink * [Introduction](#introduction) * [Asset Links](#asset-links) * [Supported links](#supported-links) * [Developer tools](#developer-tools) ## Introduction HealthChat Android supports deep linking to specific screens in the application. This document explains how to use deep links in HealthChat Android. ### Asset Links Two hosts are claimed as verified Android App Links, and each one must serve a matching asset links file listing `ch.healthchat.element` and the SHA-256 of the Play app signing certificate: | Host | Asset links file | Served from | |---|---|---| | `app.healthchat.ch` | https://app.healthchat.ch/.well-known/assetlinks.json | the `element-web` fork (`apps/web/res/.well-known/assetlinks.json`) | | `to.healthchat.ch` | https://to.healthchat.ch/.well-known/assetlinks.json | the `healthchat-matrix.to` fork (generated by `scripts/build.js`) | ### Supported links Link to a user: > https://to.healthchat.ch/#/@alice:healthchat.ch > https://app.healthchat.ch/#/user/@alice:healthchat.ch Link to a room by id or alias: > https://to.healthchat.ch/#/!roomid:healthchat.ch > https://app.healthchat.ch/#/room/#healthchat:healthchat.ch Link to a room with a specific event: > https://app.healthchat.ch/#/room/!roomid:healthchat.ch/$eventid The HealthChat matrix.to deployment hands out a custom scheme to Android, which is registered too: > healthchat://room/%23healthchat%3Ahealthchat.ch > healthchat://user/%40alice%3Ahealthchat.ch Standard Matrix URIs also work: > matrix:r/healthchat:healthchat.ch Only the two hosts above are declared in the manifest, so only those open the app from a browser. `DefaultMatrixToConverter` is host-agnostic though: any URL using the `/#/room/`, `/#/user/` or `/#/group/` path, as well as plain matrix.to links, are still resolved once they reach the app (for instance when tapped inside a message). Finally, notifications use an internal deep link that is not browsable: > healthchat://open/{sessionId}/{roomId}/{eventId} ## Developer tools Using an Android 12 or higher emulator Ensure links verification is enabled ```bash adb shell am compat enable 175408749 ch.healthchat.element.debug ``` Reset link verifications for the given package id ```bash adb shell pm set-app-links --package ch.healthchat.element.debug 0 all ``` Force the package id links to be verified ```bash adb shell pm verify-app-links --re-verify ch.healthchat.element.debug ``` Print the link verification of the package id ```bash adb shell pm get-app-links ch.healthchat.element.debug ``` ``` ch.healthchat.element.debug: ID: e2ece472-c266-4bf0-829c-be79959a6270 Signatures: [B0:B0:51:DC:56:5C:81:2F:E1:7F:6F:3E:94:5B:4D:79:04:71:23:AB:0D:A6:12:86:76:9E:B2:94:91:97:13:0E] Domain verification state: app.healthchat.ch: verified to.healthchat.ch: verified ``` Verification only succeeds if the signature above is listed in the asset links files. Release builds are signed by Google Play, so use the app signing certificate SHA-256 from the Play Console. For a debug build, add the fingerprint of `app/signature/debug.keystore` (alias `androiddebugkey`) to both files, or test with `healthchat://` links instead, which need no verification.