Handling deep links
Usage guides to help you get started with deep linking in the Android Knock SDK.
Note: We Recommend taking advantage of our KnockMessagingService & KnockActivity to make handling deep links simpler.
1. Define URL Schemes:
- In Xcode, navigate to your app target's Info tab.
- Add a new URL type under URL Types with a unique scheme.

2. Include a deep link in your Knock message payload:
- In your message payload that you send to Knock, include a property with a value of your deep link. The name of the property doesn't matter, so long as you know beforehand what it will be called.
- This can also be done in your Knock Dashboard in your Payload overrides.

3. Handle Incoming URLs:
1class MainActivity: KnockActivity() {
2 override fun onKnockPushNotificationTappedInBackGround(intent: Intent) {
3 super.onKnockPushNotificationTappedInBackGround(intent)
4
5 intent?.extras?.getString("link")?.let { deepLink ->
6 // Handle your deep link routing here
7 }
8 }
9
10 override fun onKnockPushNotificationTappedInForeground(message: RemoteMessage) {
11 super.onKnockPushNotificationTappedInForeground(message)
12
13 remoteMessage.data.isNotEmpty().let {
14 val deepLink = remoteMessage.data["link"]
15 deepLink?.let {
16 // Handle your deep link routing here
17 }
18 }
19 }
20}