AppsFlyerSDK / appsflyer-cordova-plugin

AppsFlyer plugin for Cordova
MIT License
37 stars 71 forks source link

registerOnAppAttribution Callback Doesn't Work Opening The Deeplink For The Second Time #206

Closed ramikhafagi96 closed 1 year ago

ramikhafagi96 commented 2 years ago

Report

Plugin Version

6.5.2

On what Platform are you having the issue?

iOS and Android

What did you do?

start the app and open the deeplink and redirect to a specific page, then close the page, put the app in the background and open the deeplink again

What did you expect to happen?

to put the app in the foreground again and redirect to the same page

What happened instead?

the app is brought to the foreground but doesn't redirect to the page, as registerOnAppOpenAttribution callback is not called

Please provide any other relevant information.

the callback for registerOnAppOpenAttribution is not called

this.appsflyer.registerOnAppOpenAttribution().then((result) => { // this callback doesn't get called in the second time
        const deeplinkData = JSON.parse(result);
        if (deeplinkData.type === "onAppOpenAttribution") {
          let link: string = deeplinkData.data.af_dp;
          if (link) {
            setTimeout(() => this.router.navigate([this.extractLink(link), this.getLinkParams(link)]), 2000);
          }
        } else {
          console.log("onAppOpenAttribution deeplinkData.type mismatch error");
        }
      },
      (error) => {
        console.log("error appsflyer registerOnAppOpenAttribution: ");
      });

      this.appsflyer
        .initSdk({
          devKey: environment.appsFlyer.devKey, // your AppsFlyer devKey
          isDebug: environment.debug,
          appId: environment.appsFlyer.iosAppId, // your ios appID
          waitForATTUserAuthorization: 10, //time for the sdk to wait before launch - IOS 14 ONLY!
          onInstallConversionDataListener: true,
        })
        .then(
          (result) => {
            if(environment.debug) {
            }
          },
          (error) => {
            console.log("error appsflyer initSdk");
          }
        );
    }

however in iOS console I see this but it is not passed to the callback

jsonMessageStr = {"status":"success","type":"onAppOpenAttribution","data":{"c":"Sheta Lelmestawrd","is_retargeting":"true","campaign":"Sheta Lelmestawrd","af_dp":"cartona:\/\/cartona.com\/tabs\/suppliers\/supplier-products\/1704","link":"https:\/\/cartona.onelink.me\/8xkB\/n7l124qg","deep_link_value":"cartona:\/\/cartona.com\/tabs\/suppliers\/supplier-products\/1704","media_source":"push","pid":"push"}}
pazlavi commented 2 years ago

Hi @ramikhafagi96 , Thank you for reaching out to us. To provide optimal support, we would kindly ask you to submit a support ticket to support@appsflyer.com.

When submitting the ticket, please specify your AppsFlyer sign-up (account) email, app ID, reproduction steps, code snippets, logs, the links you used, and any additional relevant information.

muneerkhan007 commented 1 year ago

OnAppOpenAttribution method is still not being called if the app is in kill state. If the app is open or it is in foreground state, this method gets called though.

ge-af commented 1 year ago

Hi @muneerkhan007 ,

Due to the complexity of this issue, We would kindly ask you to submit a support ticket to support@appsflyer.com in order to get optimal support. When submitting the ticket, please specify your AppsFlyer sign-up (account) email, app ID, reproduction steps, code snippets, logs, the links you used, and any additional relevant information.

ramikhafagi96 commented 1 year ago

@muneerkhan007 problem is solved when we migrated to capacitor and used the capacitor version of AppsFlyer (https://github.com/AppsFlyerSDK/appsflyer-capacitor-plugin)