Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Old Deeplink Triggered on Android Cold Start #155

Open
hermuxo opened this issue Sep 10, 2024 · 1 comment
Open

Old Deeplink Triggered on Android Cold Start #155

hermuxo opened this issue Sep 10, 2024 · 1 comment

Comments

@hermuxo
Copy link

hermuxo commented Sep 10, 2024

Hi there! 😊

I'm running into a bit of a tricky issue, and I hope someone can help. Sometimes, when my Android app (using launchMode: SingleTop) is opened from the background (cold start) with a deeplink, an older link is triggered instead of the correct one.
Unfortunately, I haven't been able to reliably reproduce the issue, which makes it tough to debug.

I’ve noticed it happens more often when the phone is in battery saver mode.

After reading a bit about intents, I’m wondering if the problem might be related to the intent not being cleared properly after it's handled. Would something like this help?

getActivity().setIntent(null);

Any ideas or advice would be greatly appreciated! Thanks so much! 🙏

Code called from initState()

  Future<void> initDeepLinks() async {
    _appLinks = AppLinks();
      _appLinkSubscription = _appLinks.uriLinkStream.listen((uri) {
        handleDeeplink(context, uri);
      });
  }
@bilalAppsTree
Copy link

bilalAppsTree commented Sep 23, 2024

i am facing the same issue when i open the link in debug mode the data inside intent if differ from the link i have generated for my deep linking

https://notis.page.link/rniX/?uid=3SlMSwdcuJNG2Ck92p4bOlYXZGl1&token=fOYnyjwdQleQS7Vy6cpLt5:APA91bHbG2oME9WduXJpHsiVIIvlchz-bIZGGjGqs1Ab02nQpSZUCA0Qp_bGWX_CuTgwLBliISvQEVNZH9tG4D-aB9E7e75kWhtFsuujJPY055v-zWBHWcdwYFpLYlHkIvdhTY7GaFaz
this is the link but i am receiving Link received: https://noti.com/Noti
here is my main.dart code
Future initDeepLinks(UserProviderUtils? userProviderUtils) async {
print('Waiting for links...');
_appLinks = AppLinks();

// Handle links from AppLinks stream
_linkSubscription = _appLinks.uriLinkStream.listen((uri) async {
  debugPrint('Link received: $uri');
  // https: //noti.com/Noti
  _globalProviderUtils?.initDynamicLinks(
    _userProviderUtils,
    deepLink: uri,
  );
   });

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants