We are encountering an issue with Firebase Dynamic Links on iOS. We have a Dynamic Link (DL) that resolves to open our iOS App and pass data into the App that we can then parse and trigger functionality within the App (i.e. show a screen with the data).
There are four scenarios:
Therefore scenario 2.2. is where the issue resides, implying this is an issue with handling the DL from the terminated state.
So far we have explored the following:
void initDeeplinks() async {
// Get initial dynamic link if app is started using the link
if (Platform.isIOS) {
// handle initial link with uni_links package because firebase_dynamic_links doesn't work correctly on iOS
try {
final initialLink = await getInitialLink();
log('initial link: $initialLink');
if (initialLink != null) onDeeplink(initialLink);
} on PlatformException {
log('Platform Exception');
}
} else if (Platform.isAndroid) {
final dlData = await FirebaseDynamicLinks.instance.getInitialLink();
if (dlData != null) _handleDeepLink(dlData);
}
// Listen for dynamic links while app is open
FirebaseDynamicLinks.instance.onLink.listen(_handleDeepLink).onError((error) {
log('$error');
});
}
Is this the expected behaviour for iOS apps in a terminated state? Shouldn't we be able to utilize the full functionality of fully resolved Dynamic Links once the App has opened and is in the foreground?
Any comment or related experience of managing this scenario would be greatly appreciated.
Note: Using Flutter. Tested on iOS v16 & v17
We had some trouble using the official Firebase Dynamic Links package, so we found another way.
On iOS, we used a different package called uni_links to get the dynamic link when the app starts. We used a shorter version of the Firebase Dynamic link, so the link we get can be in two different forms:
If we get a short link, we use a method from the Firebase Dynamic Links package, FirebaseDynamicLinks.instance.getDynamicLink(), to get the full link and its data before moving on.