flutter_sdk icon indicating copy to clipboard operation
flutter_sdk copied to clipboard

Flutter dynamic linking

Open Gagan5278 opened this issue 7 months ago • 6 comments

HI Team,

do you have dnamic linking demo for Flutter app, I am struggling with given documnetation example and could not achieve it

Gagan5278 avatar Jun 14 '25 13:06 Gagan5278

Hi @Gagan5278,

I am not sure what exactly are you referring to. Can you point maybe to some docs about what you are trying to achieve?

uerceg avatar Jun 16 '25 06:06 uerceg

@uerceg Thanks for your reply.

Here is basic setup I did for iOS (Already setup Associated dmain name in iOS App)

override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
    GeneratedPluginRegistrant.register(with: self)
    //Flutter Downloader Plugin
    FlutterDownloaderPlugin.setPluginRegistrantCallback(registerPlugins)

    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}

override func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
        NSLog("Scheme based deep link opened an app: %@", url.absoluteString)
       guard let deeplink = ADJDeeplink(deeplink: url) else {return false}

        // Call the below method to send deep link to Adjust backend
        Adjust.processDeeplink(ADJDeeplink(deeplink: url)!)
        return true
    }

override func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
        if (userActivity.activityType == NSUserActivityTypeBrowsingWeb) {
            NSLog("Universal link opened an app: %@", userActivity.webpageURL!.absoluteString)
            // Pass deep link to Adjust in order to potentially reattribute user.
            Adjust.processDeeplink(ADJDeeplink(deeplink: userActivity.webpageURL!)!)
        }
        return true
    }

and below is Flutter code setup

  Future<void> initPlatformState() async {
    final config = AdjustConfig('my_token', AdjustEnvironment.production);
    config.logLevel = AdjustLogLevel.verbose;
    config.isDeferredDeeplinkOpeningEnabled = true;
    config.deferredDeeplinkCallback = (String? uri) {
      print('[Adjust]: Received deferred deeplink: ${uri!}');
    };

    Adjust.initSdk(config);
  }

But deferredDeeplinkCallback never get called.

Whenever I open domain link, I can navigate from Link to the app but deferredDeeplinkCallback is not being called and so we cant detect where to land in the app.

Gagan5278 avatar Jun 16 '25 14:06 Gagan5278

Hey @Gagan5278,

Thanks for the clarification. Are you expecting the deferred deep link to be triggered when you open your already installed app with a click on a deep link? If you are, that's not what's gonna happen. Deferred deep link callback will only get triggered in case you have clicked on an Adjust link that has contained deep_link parameter inside after which you have been redirected to the store, have downloaded the app, opened the app, initialized the SDK and if that install got attributed to click on that Adjust link. In that case the SDK will get the information about the deep_link parameter from the Adjust URL and will provide this link inside of the deferred deep link callback.

Adjust SDK doesn't offer you a way to obtain the link that is opening your already installed app (that's what you can obtain on your own inside of these overloads of the openURL and continueUserActivity methods.

In case you are interested in testing the triggering of the deferred deep link callback, check out the instructions from this ticket.

Feel free to ping in case you have any questions down the road.

uerceg avatar Jun 16 '25 14:06 uerceg

@uerceg Thanks for your message.

I leave this issue as open while integrating Adjust for further issue if we face . Ill close ticket as soon as Im done with implementtation.

Gagan5278 avatar Jun 17 '25 11:06 Gagan5278

@Gagan5278 have you integrate successfully, i am struggling too?

yunusemreozturk avatar Jul 20 '25 11:07 yunusemreozturk

@yunusemreozturk yes I have done. waiting for Testing phase.

Gagan5278 avatar Jul 20 '25 12:07 Gagan5278