uni_links icon indicating copy to clipboard operation
uni_links copied to clipboard

When app is killed and open from the link then initial link concept is not working

Open rajatjain2802 opened this issue 3 years ago • 4 comments

This is My Method :

initPlatformStateForStringUniLinks() async {
    // Attach a listener to the links stream
    _sub = getLinksStream().listen((String link) {
      if (!mounted) return;
      setState(() {
        _latestLink = link ?? 'Unknown';
        print("Latest Link : $_latestLink");
        _latestUri = null;
        try {
          if (link != null) {
            _latestUri = Uri.parse(link);

            if (_latestLink.contains("lead-details")) {
              print("Lead Detail");
              leadID = _latestUri.pathSegments.elementAt(1);
              if (AppConfig.of(context).userModel.rememberDigest.isNotEmpty) {
                navigatorKey.currentState.push(new MaterialPageRoute(
                  builder: (BuildContext context) {
                    return new LeadDetailsScreen(
                      leadId: leadID,
                      isFromDeepLinking: true,
                    );
                  },
                ));
              }
            }
          }
        } on FormatException {}
      });
    }, onError: (err) {
      if (!mounted) return;
      setState(() {
        _latestLink = 'Failed to get latest link: $err.';
        _latestUri = null;
      });
    });
}

==

And initPlatformStateForStringUniLinks() this method called in initstate() in main.dart file

rajatjain2802 avatar Nov 30 '20 11:11 rajatjain2802

Any updates on this issue?

aseembajajcs avatar Mar 16 '21 14:03 aseembajajcs

We also need this to be fixed asap !

cmoellerffo avatar Mar 26 '21 09:03 cmoellerffo

@rajatjain2802 you don't seem to be using getInitialLink nor getInitialUri... the stream is for future links, while an app instance is already running in the background (or the foreground).

avioli avatar Apr 29 '21 01:04 avioli

I was facing the same issue when tapping a Push notification resulted in cold-starting the iOS application, not sure this is what you're facing, but check how I fixed mine here #129

ritaamro avatar Aug 04 '21 14:08 ritaamro