Code Monkey home page Code Monkey logo

react-native-app-link's Introduction

Logo

react-native-app-link

Easily deep link to other apps in React Native. If the app isn't installed on the user's phone, open the App Store or Play Store link instead.


NPM version badge

Example GIF

Installation:

npm i -S react-native-app-link

Usage:

import AppLink from 'react-native-app-link';

AppLink.maybeOpenURL(url, { appName, appStoreId, appStoreLocale, playStoreId }).then(() => {
  // do stuff
})
.catch((err) => {
  // handle error
});

AppLink.openInStore({ appName, appStoreId, appStoreLocale, playStoreId }).then(() => {
  // do stuff
})
.catch((err) => {
  // handle error
});

API:

maybeOpenURL(url, config) -> Promise Opens link if app is present. If not, it opens an app store to prompt the user to download it.

url: (String) a url in the specified app's deep linking format that points to the content you want to open.

config: (Object) a set of fallback urls if the app requested does not exist locally.

config.appName: (String) the app's name you're linking into.

config.appStoreId: (String) the app's ID on the App Store (iOS). Example: { appStoreId: '529379082' }

config.appStoreLocale: (String) the App Store's locale (iOS). Defaults to the USA App Store. Example: { appStoreId: 'us' }

config.playStoreId: (String) the app's package identifier on the Play Store (Android). Example: { playStoreId: 'me.lyft.android' }


openInStore(config) -> Promise Opens an app store to the listing requested.

config: (Object) a config for generate store urls.

config.appName: (String) the app's name you're linking into.

config.appStoreId: (String) the app's ID on the App Store (iOS). Example: { appStoreId: '529379082' }

config.appStoreLocale: (String) the App Store's locale (iOS). Defaults to the USA App Store. Example: { appStoreLocale: 'us' }

config.playStoreId: (String) the app's package identifier on the Play Store (Android). Example: { playStoreId: 'me.lyft.android' }

If there are any issues file an issue above and don't hesitate to spin up a PR and contribute!

react-native-app-link's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

react-native-app-link's Issues

Open Other applications on button press

@FiberJW @brentvatne @alleyhector @PeterChauYEG @sonaye

I am implementing react-native-app-link in my project but I am facing issue in the implementation I have a list of applications on the press of a specific button it should either open the app or redirect to play store or app store.

I do not have any deep-link URL for this app is there any way to achieve this?

Example for my app: IOS and Android

Package name: com.medlife.customerApp
name: MedlifePlay

iOS: package name: medlife-all-things-healthapp
id: 1078091111
App store name :Medlife

If possible please provide demo example for this library

there is no example for guidance

I made a simple button in my app named "Open Whatsapp". On press of this button i want to open whatsapp if installed it will directly open it in my phone else it will redirect me to Playstore. But i am not able to implement this. Kindly help.

What will be the url in below code and where shoid i get all these details.

AppLink.maybeOpenURL(url, { appName, appStoreId, appStoreLocale, playStoreId }).then(() => {
  // do stuff
})
.catch((err) => {
  // handle error
});

Insufficent Readme and Usage

I really like the package but can't understand how to use it.
Isn't there any example for apps we now? The gif in the readme
shows open lyft with the component but there is no code of the example.

Not Working on Expo Web

Hi !

This is not really an issue, rather a question.
Do you know how to obtain the exact same behaviour on Expo Web ?

This does work like a charm on a mobile device, in an application, but it does not work at all when running on Expo Web on a browser.

If you have any clue, I would be happy.

Thanks

If both application installed (Google Auth and Microsoft Auth) how to open specific one ?

Although I am using different type from user press and different button I am rather asking to both from any one if click on google and if Microsoft Authenticator installed and clicked on google it will open Microsoft authenticator only. Any solution ?

Above this the code I am using.

if (type === 'google') {
      AppLink.maybeOpenURL('otpauth://totp', { appName: 'google-authenticator', appStoreId: '388497605', appStoreLocale: 'in', playStoreId: 'com.google.android.apps.authenticator2' }).then(() => {
          // console.log("success")
      })
        .catch(() => {
        })
    } else {
      AppLink.maybeOpenURL('otpauth://totp', { appName: 'microsoft-authenticator', appStoreId: '983156458', appStoreLocale: 'in', playStoreId: 'com.azure.authenticator' }).then(() => {
        // console.log("success")
      })
        .catch(() => {
        })
    }

Create URL?

Can you give me a sample url. Specifically, whatsapp, not 'whatsapp://send'. As far as I know it returns 1 json string. I want to create a url myself, thank you.

Example ?

Can you provide an example in code ?
I can't seem to make it work.

Thank you !

URL should be optional.

I am trying to invoke an app from react-native app. But no idea about it's URL. Please help

Apple broke this code - how to fix.

Looks like Apple has made some breaking changes to their website that has impacted this project. I took a peek at the code and it's easy to fix...

There are two lines similar to this one:

Linking.openURL(https://itunes.apple.com/${locale}/app/${appName}/id${appStoreId}`);`

It should look like this:

Linking.openURL(https://apps.apple.com/${locale}/app/${appName}/id${appStoreId}`)`

In the second spot the part locale is replace with appStoreLocale. Otherwise the are the same.

I will be issuing a pull request to fix.

Where can I find app url?

ok there is example of usage like

import AppLink from 'react-native-app-link';

AppLink.maybeOpenURL(url, { appName, appStoreId, appStoreLocale, playStoreId }).then(() => {
  // do stuff
})
.catch((err) => {
  // handle error
});

appName, appStoreId, appStoreLocale, playStoreId - more or less clear where to get

Question:
Where can we find url parameter - obviously it should be like whatsapp://? But how as example it should be for some another JustEatApp https://play.google.com/store/apps/details?id=com.justeat.app.uk&hl=ru&gl=US ?

How you detect deeplink to open another app itself, not playstore with app?

Android app-id

Help me please, how can I find app Id for android? I tried com.instagram.android for instagram but it doesn't work: Item not found.

it always opening playstore link

Hi,

I installed this module for app linking,

My requirement:

In my react-native app i want to open the other native app.
If the native app is installed then it need to open the app.
if app is not installed then it need to open in playstore.

for that i used the code like this

code:

AppLink.maybeOpenURL('https://play.google.com/store/apps/details?id=com.ubercab.driver&hl=en',
 { appName:'Uber Driver',playStoreId:'com.ubercab.driver' }).then(() => {
    // do stuff
})
    .catch((err) => {
        // handle error
    });

as per the module Readme it need to open app if app already installed, In my device app is already installed but it is still showing the playstore link,

Can you please give me some suggestions that how can i achieve it. Any help much useful

Itunes app store link not working

Finally got your module installed after a bunch of errors (not sure what did it in the end but I've re-installed almost everything) and had it working fine when I did have the app installed but was getting an error when I tried using it when I did not have the app installed.

Firstly, here's my code example:

import {
    maybeOpenURL
} from 'react-native-app-link';

and then down in the render:

<Text style={{color: 'red'}}
                onPress={() => maybeOpenURL("lyft://", { 
                    appName: "Lyft", 
                    appStoreId: "529379082", 
                    playStoreId: "me.lyft.android" })}>
            Lyft
</Text>

(Sidenote: your documentation actually says to use import AppLink from 'react-native-app-link'; and then AppLink.maybeOpenURL... but I could not get that working so I opened up the file in the node module directly and just grabbed what I needed).

So the error I got on my simulator appeared here:
screen shot 2018-05-29 at 3 13 33 pm

And running expo directly on my phone:
rn-app-error

So I looked closer could only guess that the link you're using might need updating? You have:
https://itunes.apple.com/${locale}/app/${appStoreId}
when I replaced it with
https://itunes.apple.com/${locale}/app/${appName}/id${appStoreId}
it worked on my iphone, directing me to the app store when I didn't have the app installed.

Unfortunately, I still get the error in the simulator, which I prefer to use. Not sure if there's anything you can do about that but it would be great.

It always open either PlayStore

This is code in my app always opens Instagram in the Play Store.

AppLink.maybeOpenURL("com.whatsapp", { appName: "Whatsapp", appStoreId: "", playStoreId: "com.whatsapp" })

Please what could I be doing wrong

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.