How to properly use and manage getInitialLink when app is installed #6955
Unanswered
simonarcher
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
hi!
I wonder if anybody can help or guide me on the best way to work with
getInitialLink
when an application is installed.So to provide some context, this is my current flow Im working on...
We (lets call us
APP_A
) have partnered with another application (lets call themAPP_B
) to provide some cross-app value for our users.The idea is that a user of
APP_B
will see a promotion in that app which would require them to "redeem" it by pressing a button link inAPP_B
, which would be a firebase dynamic link, which would then take the user ofAPP_B
into ourAPP_A
with the promotional data.The challenge here is that for the majority of cases, users of
APP_B
will be directed to downloadAPP_A
from the App Store and then when our app is opened, we rely on thegetInitialLink
to grab the promotional data on app launch to then guide our users through the redemption of the promotion.So far, this is working pretty well using Dynamic Links and getting the results we want on initial testing!
However, there is a scenario Im now seeing...
When a user downloads our
APP_A
from the Dynamic Link, and thegetInitialLink
is triggered to get the pasteboard data (from what I understand this is how it works for the app to get data after an installation), during my testing if I deleteAPP_A
and download/install the app again (without using the dynamic link flow), then the app is launched again with thegetInitialLink
data, which then, in this case, would attempt to guide the user again through the promotion flow (if they had done this in a previous installation via the dynamic link).From what I understand this is sort of expected behaviour, as I read that the contents of the
getInitialLink
is not "consumed" and therefore it sort of sits there for some period of time (its strange because after testing this for a few hours, sometimes after deleting and reinstalling the application thegetInitialLink
would still have a value retained, while other installations it would benull
... Im not entirely sure the cause of this behaviour here)So Im curious, what would be, or what is, the recommended way to handle the "one time consumption" of a
getInitialLink
value?Is there any way that the client can "clear" this value programatically? Ive experienced that deleting the app does not seem to do this, and if I look at the clip board the value is not there, so its being stored in some other location I cant seem to have access to...
I read there was also a suggestion to use app state logic to determine whether this link was "handled" and prevent subsequent handling, but when a user logs out or deletes the app this state is generally cleared and so I cant rely on it to handle a fresh install scenario.
My current idea right now is to just assume that I might always run into this scenario where the app may launch with
initialLink
data which may or may not be relevant at the time, and that I should rely a server side check to determine whether this "promotion" has been redeemed and if it has been redeemed, then ignore it and move on with the standard UX. Or if it has not yet been redeemed, then continue with the promotional UX on the client.So I guess my question really is
getInitialLink
data generally cleared, and can I programmatically clear it myself? or,I appreciate the thoughts and guidance here! :)
Edit:
Apologies, I do see there was already a discussion about this here and it seems to reinforce the idea to use state logic to determine whether links should be handled on launch.
Im still curious and keen to try understand how the
initialLink
data itself is managed (ie. when is it actually cleared) and if there were potential other ways to manage this without using something like redux state management.Beta Was this translation helpful? Give feedback.
All reactions