Firebase Dynamic Link Not Opening the App

Firebase Dynamic links - when clicked not working in iOS

Finally I am able to resolve the issue.
The initial step is to create a universal link in Firebase console.
Once the universal link is created , we have to do following changes in XCode:

  1. Enable associated domains under capablities
  2. Include URL types
  3. Must verify your Team ID that you would have provided in firebase console.

Once the universal link setup is completed in Xcode, we can do build and run and check the working of Universal link.

i.e. clicking the link should open the app (provided app is already installed).
and it should not open the safari browser.

If clicking the link opens safari browser , then there is a problem with the Universal link setup.

The below tutorial is very useful:

https://youtu.be/KLBjAg6HvG0

Firebase dynamic link won't open Appstore when the app is not installed

Actually, turns out on the code inside the app to generate the dynamic link does not have the playstore app id supplied, which explains why it only broken when opening playstore but it's okay when opening appstore.

Firebase short dynamic link not working in iOS (being treated as a deeplink)

It turns out I needed to install a Capacitor Dynamic Links package for the short links to work in iOS.
https://www.npmjs.com/package/@pantrist/capacitor-firebase-dynamic-links

All I need to was install it and add the following function and it worked fine:

   FirebaseDynamicLinks.addListener('deepLinkOpen', (data) => {
console.log(data);
});

Before I was doing it like this:

   import { App, URLOpenListenerEvent } from '@capacitor/app';

App.addListener('appUrlOpen', (data: any) => {
console.log(data)
});

Note:
The dynamic link only works from the app store (no app installed) if the dynamic link has the preview set to on.

Firebase dynamic link not opening iOS app

Steps:

  1. Delete your app
  2. Restart your device.
  3. Reinstall your app and test.

As per firebase, sometimes error comes while downloading "apple-app-site-association" file associated with your domain. That's why it happens.

Check out this video: https://youtu.be/KLBjAg6HvG0?t=483 for debugging help.

Setup Dynaminc link from start: https://www.youtube.com/watch?v=KLBjAg6HvG0

If you have completed the above-mentioned steps, please check if you have the right methods implemented in your AppDelegate file.

Method 1:

    func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
if DynamicLinks.dynamicLinks().shouldHandleDynamicLink(fromCustomSchemeURL: url) {
let dynamicLink = DynamicLinks.dynamicLinks().dynamicLink(fromCustomSchemeURL: url)
self.handleDynamicLink(dynamicLink)
return true
}

return true
}

Method 2:

    func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
if let incomingURL = userActivity.webpageURL {
print(incomingURL)

let linkHandled = DynamicLinks.dynamicLinks().handleUniversalLink(incomingURL) { (dynamicLink, error) in
guard error == nil else {
print("Found an error! \(error!.localizedDescription)")
return
}

if let dynamicLink = dynamicLink {
self.handleDynamicLink(dynamicLink)
}
}

if linkHandled {
return true
} else {
//May be do other things with our incoming URL?
return false
}
}

return false
}

Handle Dynamic Link common Method:

    func handleDynamicLink(_ dynamicLink: DynamicLink?) {
guard let dynamicLink = dynamicLink else { return }
guard let deepLink = dynamicLink.url else { return }

}

Firebase Dynamic link is not opening IOS application

In my case the problem was that I made a typo in Associated domains in Xcode, instead of applinks, I typed 'applink'.

Flutter : Dynamic Link not launching the app

You should write a function to handle your dynamic links, as per the documentation, and this is working for me in an app being used currently:

void handleDynamicLinks() async {
///To bring INTO FOREGROUND FROM DYNAMIC LINK.
FirebaseDynamicLinks.instance.onLink(
onSuccess: (PendingDynamicLinkData dynamicLinkData) async {
await _handleDeepLink(dynamicLinkData);
},
onError: (OnLinkErrorException e) async {
print('DynamicLink Failed: ${e.message}');
return e.message;
},
);

final PendingDynamicLinkData data =
await FirebaseDynamicLinks.instance.getInitialLink();
_handleDeepLink(data);
}

// bool _deeplink = true;
_handleDeepLink(PendingDynamicLinkData data) async {

final Uri? deeplink = data.link;
if (deeplink != null) {
print('Handling Deep Link | deepLink: $deeplink');
}
}

and in initState:

@override
void initState() {
handleDynamicLinks();
super.initState();
}

write this logic in your home page. Not in void(main..etc)
But in your first widget after that, and it should work.

Also, be sure to double check your package name, i.e com.example.yourAwesomeApp123, it's what lets the whole system know what app is to be opened when the dynamic link is pressed.



Related Topics



Leave a reply



Submit