3

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));
11
  • Is the app installed in the android device already, while you are running your code? Commented Oct 18, 2018 at 11:02
  • @Sateesh yup.. my task is have to open the app if it is installed, or open playstore. Commented Oct 18, 2018 at 11:06
  • is com.inova.velocity developed by you? Commented Oct 18, 2018 at 12:01
  • @VinayakB No.. its downloaded one. Commented Oct 18, 2018 at 12:02
  • is com.inova.velocity have any deep link associate with app? Commented Oct 18, 2018 at 12:04

2 Answers 2

2

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');
           );

Sign up to request clarification or add additional context in comments.

3 Comments

How we can find this SchemaUrl?
SchemaUrl needs to be configure in relavant app
Can please share some doc related to this SchemaUrl?
-1

using react-native-send-intent module , you can do
SendIntentAndroid.openApp('packagename').then((wasOpened) => {}); where your package name is whatever application package name you want to open.

for eg SendIntentAndroid.openApp('com.inova.velocity').then((wasOpened) => {});

wasOpened is a Boolean promise telling you whether the app was opened or not

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.