1
votes

I've already read this Link

which looks like a similar issue but unfortunately this doesnt helped me out

Creating Deep Link

static Future<String> createDeppLink(String id) async {
    String prefix = "https://skribbll.page.link";
    final DynamicLinkParameters par = DynamicLinkParameters(
      uriPrefix: prefix,
      link: Uri.parse("https://skribbll.page.link/join/?id=$id"),
      androidParameters: AndroidParameters(
          packageName: "com.example.Skribbl", minimumVersion: 0),
      iosParameters: IosParameters(
        bundleId: 'com.example.Skribbl',
        minimumVersion: '1',
        appStoreId: '',
      ),
    );
    final Uri dynamicUrl = await par.buildUrl();

    print(dynamicUrl);
    final ShortDynamicLink shortenedLink =
        await DynamicLinkParameters.shortenUrl(
      dynamicUrl,
      DynamicLinkParametersOptions(
          shortDynamicLinkPathLength: ShortDynamicLinkPathLength.unguessable),
    );
    print(shortenedLink.shortUrl);
    String url = shortenedLink.shortUrl.toString();
    return url;
  }

Handling Deep Link

  static Future handleDynamicLinks() async {
    print("Coming to handle dynamic links");
    await Future.delayed(Duration(seconds: 3));
    var value = await FirebaseDynamicLinks.instance.getInitialLink();
    var x = handleDeepLinkData(value);
    print(x);
    FirebaseDynamicLinks.instance.onLink(onSuccess: (dynamicLink) async {
      var x = handleDeepLinkData(dynamicLink);
      print("Inside listener");
      print(x);
    }, onError: (e) async {
      debugPrint('DynamicLinks onError $e');
    });
    return x;
  }

  static handleDeepLinkData(PendingDynamicLinkData data) {
    print("Coming to handle deep link data");
    print(data);

    if (data == null) return null;
    final Uri deepLink = data?.link;

    if (deepLink != null) {
      print(deepLink);
      if (deepLink.path.contains("join")) {
        print(deepLink.queryParametersAll);
        print(deepLink.queryParameters['id']);
        return deepLink.queryParameters['id'];
      }
    }
  }

I found lot of answers and tried tweaking almost everything but still not getting the id parameter passed while creating deep link
what I am getting is demo data added in FireBase console while setting up DynamicLink In FireBase console I've already setted up

Short Link Url -> https://skribbll.page.link/join
Dynamic Link Url -> https://skribbll.page.link/join?id=5

When I didn't set up those through console I was not getting redirected to my app
I dont know exactly what I am doing wrong any help can save me a lot of time
ThankYou in advance
One more thing I wanna add when trying to genearte full URL it looks like this and have id in it
If this can be of any help

https://skribbll.page.link?apn=com.example.Skribbl&link=https%3A%2F%2Fskribbll.page.link%2Fjoin%3Fid%3DqMj2YBTKATcPHYDsnQNq
1

1 Answers

1
votes

You can use ?d=1 to debug you link as per the doc's. Warnings found on the link supplied in your post. These were the warnings I found when running on yours

I found this blog particularly helpful when setting up mine.