Reputation: 335
Deep linking is not working on android when the app is on background or foreground state, but if it's closed it works perfectly fine. Only in android but in iOS it works both even if it's in background or closed app state.
I have these methods, but it doesn't work on android when it's on background or foreground
1. Linking.addEventListener('url', callback)
2. Linking.getInitialURL -- it returns a Promise that resolves to the url, if there is one.
Upvotes: 1
Views: 3272
Reputation: 43
Linking.canOpenURL(ValidateRedirectionData.responseDto.redirectUrl).then(
(supported) => {
console.log(supported, "sup--------------");
Linking.openURL(ValidateRedirectionData.responseDto.redirectUrl);
console.log("deeplinking2------------------------");
}
);
try like this
Upvotes: 0
Reputation: 335
Finally I figured it out, Linking.addEventListener('url', callback)
returns and event, to get the url it should be event.url
, what I did before is Linking.addEventListener('url',(url) => setLink(url))
which must be Linking.addEventListener('url',({ url }) => setLink(url))
.
Upvotes: 2