AppsFlyerSDK / appsflyer-flutter-plugin

Flutter Plugin for AppsFlyer SDK
MIT License
142 stars 111 forks source link

Not Able to trigger onDeepLinking on the first launch. #270

Open Dolar1 opened 1 year ago

Dolar1 commented 1 year ago

Describe the bug As mentioned here in the DOC, in the onDeepLinking section,

But I am getting the below response in the DeepLinkResult, but this is only when the app is in the foreground, and getting nothing in callback if the app is killed. while testing deferred deeplink.

DeepLinkResult:{"status":"FOUND","error":null,"deepLink":{"af_dp":"xxxstaging://order-history","path":"","media_source":"appsflyer_sdk_test_int://","scheme":"xxxstaging","link":"xxxstaging://order-history?AID=105b6034-a5cc-47ea-add5-f1d6589fb0ed&af_android_url=https://xxx.co.id/&af_deeplink=true&af_dp=xxxstaging%3A%2F%2Forder-history&af_force_deeplink=true&af_web_id=653a63a1-8a78-4a7f-8d25-77191302be85-o&campaign=None&clickid=515b5c76-bef8-4b66-b4ba-5515ff3c0b4a&is_retargeting=true&media_source=appsflyer_sdk_test_int://","host":"order-history","campaign":"None","AID":"105b6034-a5cc-47ea-add5-f1d6589fb0ed","is_deferred":false}}

To Reproduce Steps to reproduce the behavior:

  1. using appsflyer_sdk: 6.11.1
  2. using flutter 3.10.4
  3. integrated the SDK with onDeepLinking and used an in-app deep linking dispatcher to handle the navigation.
  4. I kill the app 3 times as mentioned in the Run retargeting test from SDK Integration Tests, & get the above response (to note, I get the above response only in the foreground & not when the app is killed.)

Expected behavior Failed to navigate, while performing the test not able to get to the onDeepLinking callback itself if the app is killed, performed test multiple times. But navigates when the app is in the foreground only, that too using dp.deepLink?.clickEvent["af_dp"] & not using dp.deepLink?.deepLinkValue which is mentioned in the doc link here.

Screenshots

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context

github-actions[bot] commented 1 year ago

πŸ‘‹ Hi @Dolar1 and Thank you for reaching out to us. In order for us to provide optimal support, please submit a ticket to our support team at support@appsflyer.com. When submitting the ticket, please specify:

acacioveit commented 11 months ago

hey @Dolar1 did you manage to solve this issue?

acacioveit commented 11 months ago

@pazlavi do we have an update on this one? I'm facing the same issue here...

Dolar1 commented 11 months ago

Hey @acacioveit yeah i managed to solve this issue i think Appsflyer team needs to correct the docs a little.

  1. Scenario 1 [If you want to Use deferred deeplink]

    • This gives us the Callback on first install of app lifecycle.
    • Where deepLinkData stores the data whoch is given to us by appsflyer in this doc
    _appsflyerSdk.onInstallConversionData((res) {
      var deepLinkData = AppsFlyerDeepLink(res["payload"]);
      if (_isFirstInstall(res["payload"])) {
        _handleDeferredDeeplink(deepLinkData);
        _trackInstallEvent(deepLinkData);
      }
    });
  2. Scenario 2 [If you want to use just deeplink]

    appsflyerSdk.onDeepLinking((DeepLinkResult dp) {
      switch (dp.status) {
        case Status.FOUND:
          print(dp.deepLink?.toString());
          print("deep link value: ${dp.deepLink?.deepLinkValue}");
          break;
        case Status.NOT_FOUND:
          print("deep link not found");
          break;
        case Status.ERROR:
          print("deep link error: ${dp.error}");
          break;
        case Status.PARSE_ERROR:
          print("deep link status parsing error");
          break;
      }
    }

    This is what i observed while integrating the same.

    If you need further assistance in integrating let me know

acacioveit commented 11 months ago

Thanks @Dolar1, my code was very similar to yours.

The problem was that I wasn't understanding correctly some part of the docs (which is very confusing) from appsflyer website.

I was calling onDeepLinking after initSdk.

Thank you very much for your time :)

hamberluo commented 11 months ago

Describe the bug As mentioned here in the DOC, in the onDeepLinking section,

  • Does not provide af_dp in the API response.

But I am getting the below response in the DeepLinkResult, but this is only when the app is in the foreground, and getting nothing in callback if the app is killed. while testing deferred deeplink.

DeepLinkResult:{"status":"FOUND","error":null,"deepLink":{"af_dp":"xxxstaging://order-history","path":"","media_source":"appsflyer_sdk_test_int://","scheme":"xxxstaging","link":"xxxstaging://order-history?AID=105b6034-a5cc-47ea-add5-f1d6589fb0ed&af_android_url=https://xxx.co.id/&af_deeplink=true&af_dp=xxxstaging%3A%2F%2Forder-history&af_force_deeplink=true&af_web_id=653a63a1-8a78-4a7f-8d25-77191302be85-o&campaign=None&clickid=515b5c76-bef8-4b66-b4ba-5515ff3c0b4a&is_retargeting=true&media_source=appsflyer_sdk_test_int://","host":"order-history","campaign":"None","AID":"105b6034-a5cc-47ea-add5-f1d6589fb0ed","is_deferred":false}}

To Reproduce Steps to reproduce the behavior:

  1. using appsflyer_sdk: 6.11.1
  2. using flutter 3.10.4
  3. integrated the SDK with onDeepLinking and used an in-app deep linking dispatcher to handle the navigation.
  4. I kill the app 3 times as mentioned in the Run retargeting test from SDK Integration Tests, & get the above response (to note, I get the above response only in the foreground & not when the app is killed.)

Expected behavior Failed to navigate, while performing the test not able to get to the onDeepLinking callback itself if the app is killed, performed test multiple times. But navigates when the app is in the foreground only, that too using dp.deepLink?.clickEvent["af_dp"] & not using dp.deepLink?.deepLinkValue which is mentioned in the doc link here.

Screenshots

  • NA

Desktop (please complete the following information):

  • NA

Smartphone (please complete the following information):

  • Device: realme narzo 20 pro
  • OS: Android 12
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context

You need to call onDeepLink before calling init.

ianoliveira12 commented 2 months ago

@al-af I have same problem! When I click on the link and install the app, the deepLinkValue is null on the first launch, but when the app is already installed and opened, the value is filled in