问题
I am writing code to launch other applications from my react native application for android
and ios
.
Using Linking
form react native I am able to redirect to Play Store/App Store
but
How can I launch App if it's already installed?
* I am getting the list of the app's from server
Linking.openURL('https://play.google.com/store/apps/details?id=com.example.myapp&hl=en')
Is there any way that I can launch the app
if it's installed else redirect to App store/play store
with respect to the platform?
Reference:react-native-app-link
回答1:
After many searches I have found an alternative for android
without deep link URL
is to use the native module react-native-intent-launcher to launch another app using package-name
.
You can call the native function startActivity
in react-native
to do something with Intent
which can only be solved with android native code
.
Looking for iOS
solution without deep link URL
if any lead please update here
Once I found I will update Here
Thank you
回答2:
Your other app need to handle Deeplinking. If that's not already the case, have a look here for Android and here for iOS.
This will allow you to have your app's own URL scheme, for example testapp://example
Then you can simply use the Linking API, but instead of opening a HTTP URL, you can use you Deeplink URL scheme defined previously.
Linking.openURL('testapp://example');
来源:https://stackoverflow.com/questions/58856557/how-to-open-other-application-from-my-application