I am trying to open a another app(https://play.google.com/store/apps/details?id=com.inova.velocity) from my app. But there are all the tutorial just redirecting url to playstore only.(I found a github link(https://github.com/FiberJW/react-native-app-link) and it opens the app for iOS only, but for Android it is redirecting to playstore). Is there is any way to solve this problem?
Linking.canOpenURL('market://details?id=com.inova.velocity')
.then((canOpen) => {
if (canOpen) {
console.log('open app');
return Linking.openURL('market://details?id=com.inova.velocity')
};
}).catch(err => console.log('An error occurred', err));
Yes your code is correct. But you have used playstore url, instead of schema url. you have to set the schemaUrl which you can get it from relevant app developer. if there is no schema url set for the that app you can't open it. after you get the SchemaUrl you can use your code. like below.
Linking.canOpenURL(SchemaUrl).then(supported => {
if (supported) {
console.log('accepted');
return Linking.openURL(SchemaUrl);
} else {
console.log('an error occured');
}
}).catch(
err => console.log('an error occured');
);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With