I'm using Firebase dynamic link for the purpose of Refer and Earn. Generally, a user (say Receiver
) can download the app in 2 ways:
Installing the app from Play Store (organic download).
Installing the app using the dynamic link.
Now, how would I know if the app was installed in Receiver
's phone using the dynamic link shared with him by another user (say Sender
).
This is the code for listening app open and it runs for both scenario mentioned above. I am not able to detect if the app was installed using the dynamic link.
void _listeningAppOpen() async {
PendingDynamicLinkData data = await FirebaseDynamicLinks.instance.getInitialLink();
Uri deepLink = data?.link;
if (deepLink != null) {
// app opened by dynamic link
}
FirebaseDynamicLinks.instance.onLink(onSuccess: (PendingDynamicLinkData dynamicLink) async {
Uri deepLink = dynamicLink?.link;
if (deepLink != null) {
// app was already opened (in background) and user clicked on dynamic link, we are here now
}
});
}