The nudge library supports deep linking into the mobile banking application via customized links embedded in nudges. This enables direct navigation to specific pages within the app when the recipient taps a notification. This can be used to promote new features or to offer an effortless user experience based on proactive alerts requiring action. Implementing deep linking is easy and straightforward, as documented in this guide.
Android
Deep linking functionality requires the nudge Plus code library for Android version 3.5.0 or higher. When a nudge notification is sent to the user’s device, a Pending Intent is created that contains an Intent we use to control the logic that is performed when a notification is tapped. When this Tap Intent is triggered by a user tapping the notification, we send an Intent that contains the following information:
- In the data payload, we will present the
messageUrl, which contains the deep link URL - In the extras, we present the
isDeepLink, which contains a boolean value of whether the link provided is a deep link - In the extras, we provide the
messageUrlflag which also contain the deep link URL
This intent is sent when tapped and can be dealt with by adding your routing logic into your Android lifecycle method of choice that best fits your app’s behavior (ex: onStart(), onCreate(), onNewIntent()).
Here is an example of how this can be accomplished in Kotlin:
override fun onStart() {
val intent: Intent? = Intent(this, <<ActivityNameHere>>)
}
if (intent != null) {
handleDeepLinkTap(intent)
}
}
override fun handleDeepLinkTap(intent: Intent): Boolean {
if (intent.getBooleanExtra(deepLinkKey, false)){
intent.getStringExtra(messageUrl).let { uri ->
MainScope().launch {
try {
// Handle Routing Logic here
} catch (ex: Exception) {
}
}
}
iOS
Deep linking functionality requires nudge Plus code library for iOS version 2.1.0 or higher. When sending a notification with a deep link URL attached, you can add your logic to handle the routing in the userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response:
UNNotificationResponse) method after our Nudge.tappedNotification() function is called.
To get the deep link attached to the response object you can grab it with this code: response.notification.request.content.userInfo["message_url"]
as? String
To check if a tap response contains a deep link, you can grab this info with the following code: isDeepLink = response.notification.request.content.userInfo["is_deep_link"]
as? Bool ?? false
Here is an example of what this can look like in Swift:
@MainActor
public override func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse) async {
var optionalUrlResponse : String?
var isDeepLink : Bool
optionalUrlResponse = response.notification.request.content.userInfo["message_url"] as? String
isDeepLink = response.notification.request.content.userInfo["is_deep_link"] as? Bool ?? false
Nudge.tappedNotification(notification: response.notification)
if (isDeepLink) {
// Handle Routing Logic here
}
}
We're here to help!
Have questions? Want to schedule time with our technical team to discuss implementation details. Just reach out to us through the Submit a request link above, or email us at support@larky.com.
Comments
0 comments
Article is closed for comments.