Repository navigation
Conversation
…round When a OneLink is opened while the app is already in the foreground (for example, from a notification), Android only pauses the Activity around onNewIntent and never stops it. The SDK resolves warm-start deep links when the Activity resumes after being stopped, so the registered DeepLinkListener was never called in this case. Plugin 6.18.0 fixed the same case by calling performOnDeepLinking from the onNewIntent listener; that call was lost in the SDK 7 rewrite. Forward the VIEW intent to AppsFlyerLib.performDeepLinking instead, but only when the Activity has not been stopped since it last resumed: when the app comes back from the background the SDK resolves the intent itself, and forwarding it as well would deliver the deep link twice. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Thanks for the detailed report and repro table. We're going to decline this change, because this is intended behavior and not a regression. Why. In the AppsFlyer SDK, a OneLink is resolved when the app comes to the foreground. A link that is handled while the app is already in the foreground, for example from a notification tap or a link inside the app, is not resolved automatically. This has been the SDK's behavior for many years. For that case the app calls Plugin 6.x had some plugin-specific handling around What to do in your app. In your notification-tap or link handler, call: AppsFlyerSdk.instance.performDeepLinking(url, shouldTriggerSession: false);The result arrives in your Why we're not forwarding in the plugin. The SDK already handles links when the app returns from the background, so the plugin would also forward some links the SDK resolves itself, and those could be delivered twice. We also think this change might deliver the same deep link twice: once when it is forwarded in the foreground, and again when the app moves to the background and then comes back to the foreground. Keeping a single, explicit entry point avoids that. If you want to go through your use case or look at other options, please contact our support team and they'll help you adjust your integration. |
What
Deliver deep links on Android when a OneLink is opened while the app is already in the foreground.
Why
Since 7.0.x,
registerDeepLinkListener's callback is not called when a OneLink (App Link) is opened while the app is in the foreground — for example, when a notification containing a OneLink is tapped while the app is open. The same case works on 6.18.1.AppsFlyerLib.performOnDeepLinking(intent, application)from theonNewIntentlistener (CHANGELOG: "Fixed Android warm-app deep link consumption race…"; the same problem was reported in dev/fix-deeplink-on-foreground: Fix deeplink when app is in foreground #448).onNewIntentlistener but dropped that call, so the regression came back.In this case Android only pauses the Activity around
onNewIntentand never stops it. The SDK resolves warm-start deep links when the Activity resumes after being stopped, so the intent is never resolved.How
In the
onNewIntentlistener, forward theVIEWintent's URL toAppsFlyerLib.performDeepLinking(url, false)(the SDK 7 replacement forperformOnDeepLinking), but only when the Activity has not been stopped since it last resumed.onStop→onStart→onNewIntent→onResume), the SDK already resolves the intent itself. Forwarding it there as well delivers the deep link twice, which I reproduced on a device with an unconditional call.onNewIntentcannot tell the two cases apart (it isSTARTEDin both), so the plugin observes the attached Activity's lifecycle and remembers whetherON_STOPhappened since the lastON_RESUME. The observer is removed when the Activity detaches.shouldTriggerSessionisfalse: sessions are still sent from the session-readystart()call, so no extra Launch is added.LifecycleOwnerkeeps the current behavior.Testing
Device: Pixel 8 Pro (Android 17). A Flutter app that registers
registerDeepLinkListener→init→registerSessionReadyListener(start()inside), with the dev-flavor OneLink App Link manually approved. Links were opened withadb shell am start -a android.intent.action.VIEW -d <OneLink>. Numbers areonDeepLinkingcallbacks /Launchevents per step.flutter test test— all tests passed./gradlew :appsflyer_sdk:testDebugUnitTest(fromexample/android) — all tests passed