Deeplink callback in InApp
It is used to navigate users directly to a specific location or content within a mobile app.
Default Handling
By default, SDK passes the deep link callback to the AppDelegate/SceneDelegate method .
If your application is running below iOS 13, then deep link callback is received in the AppDelegate methods
import UIKit
// Custom Scheme Link
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) - Bool {
//Call only if MoEngageAppDelegateProxyEnabled is NO in Info.plist
MoEngageSDKAnalytics.sharedInstance.processURL(url)
}
// Universal Links
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) - Void) - Bool {
if userActivity.activityType == NSUserActivityTypeBrowsingWeb ,
let incomingURL = userActivity.webpageURL{
//Call only if MoEngageAppDelegateProxyEnabled is NO in Info.plist
MoEngageSDKAnalytics.sharedInstance.processURL(incomingURL)
}
//rest of the implementation
return true
}
// Custom Scheme Link
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<uiapplicationopenurloptionskey,id> *)options {
return true;
}
// Universal Link
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray * _Nullable))restorationHandler {
return true;
}
@end
If your application is above iOS 13, then a deeplink callback is received in the below SceneDelegate method
import UIKit
// Custom Scheme Link
func scene(_ scene: UIScene, openURLContexts URLContexts: Set) {
let url = URLContexts.first?.url
MoEngageSDKAnalytics.sharedInstance.processURL(url)
}
// Universal Scheme Link
func scene(_ scene: UIScene, continue userActivity: NSUserActivity) {
if let url = userActivity.webpageURL {
MoEngageSDKAnalytics.sharedInstance.processURL(url)
}
}
}
Custom Handling
To receive the deeplink callback in the MoEngageInAppNativeDelegate , do pass MoEngageInAppConfig(shouldProvideDeeplinkCallback: true) while initializing the MoEngageSDKConfig object.
Refer to the doc for callback methods.
warning |
SDK Version Custom Deeplink Callback is supported MoEngageInApp @ 6.00.0. |