-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
Linking.getInitialURL() for android #25675
Comments
I can confirm that on Android, if the app is closed, InteractionManager.runAfterInteractions, will not work and then the getInitialURL will not return anything. But if the app was opened, everything works just fine. I removed the InteractionManager.runAfterInteractions and the deep linking on Android, when the app is closed, works again Thanks @sajaddp |
I fixed by that:
|
I'm also facing this issue on RN v0.59.8. I'm trying to use aws-amplify library and they make use of Linking.getInitialUrl() to listen to the Deeplink URL but it is always returning null. Can anyone suggest some solutions that I can try? |
Same here iOS is working great but Android fails.
|
We are seeing what we think is the same issue—works great on iOS, fails on Android cold starts. In particular, it fails on Android 10. It works on an old Android 7 phone I have. |
Any update on this? Or workaround? |
Interestingly, I even changed code to: But to no avail... Samsung S9 refuses to call the |
|
UPDATE:
And please note the differing behaviour on different Android devices during my testing. This was a consistent failure on Samsung, but consistently fine on Google Pixel I will attempt to do a |
I can confirm that I have this issue since I've updated from 0.59.* to 0.61.* |
Is there any update on this issue? I'm experiencing the same. Not being able to utilize deep linking is a huge miss right now. |
Is there any update? The bug still continues |
Finally am not dumb.... Is there any update? The bug still continues |
The same issue.
|
Same here on 0.61.5 |
Any progress on this? Seems mind boggling to me that deeplinking is just completely broken in RN for Android? |
It’s not completely broken for me. It works for an already started app, but not for a newly started one. |
Well I'd argue that is almost completely broken then. Deeplinking is usually used when the app is not open. |
The culprit seems to be this line here react-native/Libraries/Linking/Linking.js Line 88 in c0d8c1d
After removing it it worked 100% of the times, so @Stephen2 workaround actually fixes it by the time being...
|
I've tried that earlier
|
It's seems still a bug when app is from background to foreground Linking.getInitialURL return null |
Hi @footniko |
I ended up using this workaround: In App.js:
My AndroidManifest.xml looks like this:
RN 0.68.0 |
To expand on @footniko answer, we are using Expo SDK v44 (React Native v0.64). In order to do so when using Expo you need to follow the instructions here: Keep in mind, in Expo when you change the If you are not using Expo then you will probably need to apply the same |
I was struggling with this issue recently as well and found two things. 1) The above resolved the issue on Android for me. 2) The root cause of my issue actually turned out to be a custom animation using React Native Hope that helps someone. |
Summary: This was originally added in D15258046 (facebook@c802d0b) but seems to be the wrong solution to the problem from my perspective. InteractionManager does not provide timing information on the activity being available, but ReactContext's LifecycleEventListener does. This should also address some of the issues raised in facebook#25675 Changelog: [Android][Fixed] Linking.getInitialUrl should not wait for InteractionManager Differential Revision: D41157646 fbshipit-source-id: 486088e2948c0c0c83bbfbd25036e1f34017429f
Summary: Pull Request resolved: facebook#35289 This was originally added in D15258046 (facebook@c802d0b) but seems to be the wrong solution to the problem from my perspective. InteractionManager does not provide timing information on the activity being available, but ReactContext's LifecycleEventListener does. This should also address some of the issues raised in facebook#25675 Changelog: [Android][Fixed] Linking.getInitialUrl should not wait for InteractionManager Differential Revision: D41157646 fbshipit-source-id: 610ee440c38cb6e5b7e0b8d808e0e2e73599404c
Summary: Pull Request resolved: #35289 This was originally added in D15258046 (c802d0b) but seems to be the wrong solution to the problem from my perspective. InteractionManager does not provide timing information on the activity being available, but ReactContext's LifecycleEventListener does. This should also address some of the issues raised in #25675 Changelog: [Android][Fixed] Linking.getInitialUrl should not wait for InteractionManager Reviewed By: mdvacca Differential Revision: D41157646 fbshipit-source-id: 6e23969212570204a7e076b6d4d9db004412da09
what did you fix in your intentFilters @footniko ? |
Check this reply: #25675 (comment) |
Still an issue in 0.68.5. |
Summary: Pull Request resolved: facebook#35289 This was originally added in D15258046 (facebook@c802d0b) but seems to be the wrong solution to the problem from my perspective. InteractionManager does not provide timing information on the activity being available, but ReactContext's LifecycleEventListener does. This should also address some of the issues raised in facebook#25675 Changelog: [Android][Fixed] Linking.getInitialUrl should not wait for InteractionManager Reviewed By: mdvacca Differential Revision: D41157646 fbshipit-source-id: 6e23969212570204a7e076b6d4d9db004412da09
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
This issue is still valid IMO; please remove the stale label. |
Has there been any update on this issue? |
could you provide a minimum reproducible example? It is documented also in the react-native documentation https://reactnative.dev/docs/next/linking#getinitialurl
|
I've just started to get this issue after upgrading to 0.73, it is adding approximately 10s onto my app startup time waiting to resolve the promise. It looks like in 0.73 the code has been moved to native code so the above workarounds will now no longer work. Also for me I think the reason I get this is due to the fact im calling Linking.getInitialUrl as early as possible in my app start, even before a screen has been rendered. I don't really want to change this because the initial url can actually determine alot about how my app starts up in testing scenarios. I can only think that it should be optional to wait for an activity? (im not up on android app lifecycles though) |
Facing this issue sometimes while trying to get initial url as soon as possible on the startup Seems like something relates to the this topic
|
still valid |
@TomasSestak I did extensive testing on this yesterday and didn't find an issue with |
Just got it from crashyltics with latest RN. |
I am also facing this problem other import NativeIntentAndroid from 'react-native/Libraries/Linking/NativeIntentAndroid' |
any work around? |
Hi,
On Android
Linking.getInitialURL()
has a problem and not return anything.More precisely, none of the following logs are executed.
but when i change https://github.com/facebook/react-native/blob/master/Libraries/Linking/Linking.js#L86-L92
to:
the problem was fixed.
React Native version:
The text was updated successfully, but these errors were encountered: