Open Chepond opened 5 years ago
same thing on Android
Same here:
I ended up doing something like this with https://pub.dev/packages/synchronized:
// Attach a listener to catch any links when app is running in the background
_uniLinksSub = getUriLinksStream().listen((Uri uri) async {
await _previousUniUriLock.synchronized(() async {
if (_previousUniUri == uri) // this seems to be invoked twice so ignore the second one
_previousUniUri = null; // clear the uri here though so the user can manually invoke twice
else {
await processUri(uri);
_previousUniUri = uri;
}
});
}, onError: (err) {
print('uri stream error: $err');
});
Same here on iOS
Same here except it'll fire 4-5 times
any idea how resolve this case? same error here
I am stuck on this issue. For detail, the uriLinkStream.listen() the onData props returns twice the same URI.
uriLinkStream.listen((Uri? uri) async {
print('Deep link : $uri'); // I got twice comment here
});
Anyone has ideas or solutions for this issue!!
Any updates?
In my case I have an endless number of updates. It seems to depend on urls length and device, becouse i have links which was listen once. In my case phone is Huawei p20 pro.
I added a 1 second delay after receiving a link like so:
class DeepLinking {
DateTime? _lastDeepLinkTime;
StreamSubscription<Uri>? _appLinkSubscription;
final _appLinks = AppLinks();
void enable() {
_appLinkSubscription = _appLinks.uriLinkStream.listen((appLink) {
// poor man's debounce
if (_lastDeepLinkTime != null && DateTime.now().difference(_lastDeepLinkTime!) < const Duration(seconds: 1)) return;
_lastDeepLinkTime = DateTime.now();
_handleAppLink(appLink);
}
}
Describe the bug getUriLinksStream().listen((Uri uri) { }, onError: (err) { }); } on PlatformException { // Handle exception by warning the user their action did not succeed // return? } this method is invoked twice everytime the app is being called by scheme I am using custom deep linking, not associated one..
To Reproduce Steps to reproduce the behavior:
Expected behavior code invoked once should be expected
Smartphone (please complete the following information): iOS iphone XS Max simulator iOS 12
Additional context
my code snipset as below:
Future initUniLinks() async {
}