appsflyer-flutter-plugin icon indicating copy to clipboard operation
appsflyer-flutter-plugin copied to clipboard

Not Able to trigger onDeepLinking on the first launch.

Open Dolar1 opened this issue 2 years ago • 7 comments

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

Dolar1 avatar Jun 18 '23 07:06 Dolar1

👋 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 [email protected]. When submitting the ticket, please specify:

  • ✅ your AppsFlyer sign-up (account) email
  • ✅ app ID
  • ✅ production steps
  • ✅ logs
  • ✅ code snippets
  • ✅ and any additional relevant information.

github-actions[bot] avatar Jun 18 '23 08:06 github-actions[bot]

hey @Dolar1 did you manage to solve this issue?

acacioveit avatar Jul 07 '23 22:07 acacioveit

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

acacioveit avatar Jul 10 '23 15:07 acacioveit

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);
    }
  });
  1. 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

Dolar1 avatar Jul 10 '23 17:07 Dolar1

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 :)

acacioveit avatar Jul 11 '23 00:07 acacioveit

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.

hamberluo avatar Jul 25 '23 07:07 hamberluo

@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

ianoliveira12 avatar Apr 10 '24 10:04 ianoliveira12