Expo

Get Started
API Reference

Linking

expo-linking provides utilities for your app to interact with other installed apps using deep links. It also provides helper methods for constructing and parsing deep links into your app. This module is an extension of the React Native Linking module.
For a more comprehensive explanation of how to use expo-linking, refer to the Linking guide.

Platform Compatibility

Android DeviceAndroid EmulatoriOS DeviceiOS SimulatorWeb

Installation

expo install expo-linking

If you're installing this in a bare React Native app, you should also follow these additional installation instructions.

import * as Linking from 'expo-linking';

Add a handler to Linking changes by listening to the url event type and providing the handler. It is recommended to use the useURL() hook instead.

  • type (string) -- The only valid type is 'url'.
  • handler (function) -- A function that takes an event object of the type { url: string }.

Determine whether or not an installed app can handle a given URL.

  • url (string) -- The URL that you want to test can be opened.

A Promise object that is fulfilled with true if the URL can be handled, otherwise it false if not.
The Promise will reject on Android if it was impossible to check if the URL can be opened, and on iOS if you didn't add the specific scheme in the LSApplicationQueriesSchemes key inside Info.plist.

Helper method for constructing a deep link into your app, given an optional path and set of query parameters. Creates a URI scheme with two slashes by default.

  • path (string) -- Any path into your app.
  • options:
    • queryParams (object) -- An object with a set of query parameters. These will be merged with any Expo-specific parameters that are needed (e.g. release channel) and then appended to the url as a query string.
    • scheme (string) -- Optional URI protocol to use in the URL <scheme>://, when undefined the scheme will be chosen from the Expo config (app.config.js or app.json).

A URL string which points to your app with the given deep link information.

Get the URL that was used to launch the app if it was launched by a link.

The URL string that launched your app, or null.

An alias for Linking.createURL(). This method is deprecated and will be removed in a future SDK version.
Helper method for constructing a deep link into your app, given an optional path and set of query parameters. Creates a URI scheme with three slashes for legacy purposes.

  • path (string) -- Any path into your app.
  • queryParams (object) -- An object with a set of query parameters. These will be merged with any Expo-specific parameters that are needed (e.g. release channel) and then appended to the url as a query string.
  • scheme (string) -- Optional URI protocol to use in the URL <scheme>:///, when undefined the scheme will be chosen from the Expo config (app.config.js or app.json).

A URL string which points to your app with the given deep link information.

Open the operating system settings app and displays the app’s custom settings, if it has any.

Attempt to open the given URL with an installed app. See the Linking guide for more information.

  • url (string) -- A URL for the operating system to open, eg: tel:5555555, exp://.

A Promise that is fulfilled with true if the link is opened operating system automatically or the user confirms the prompt to open the link. The Promise rejects if there are no applications registered for the URL or the user cancels the dialog.

Helper method for parsing out deep link information from a URL.

  • url (string) -- A URL that points to the currently running experience (e.g. an output of Linking.createURL()).

An object with the following keys:
  • path (string) -- The path into the app specified by the url.
  • queryParams (object) -- The set of query parameters specified by the query string of the url.

Helper method which wraps React Native's Linking.getInitialURL() in Linking.parse(). Parses the deep link information out of the URL used to open the experience initially.

A promise that resolves to an object with the following keys:
  • path (string) -- The path specified by the url used to open the app.
  • queryParams (object) -- The set of query parameters specified by the query string of the url used to open the app.

Remove a handler by passing the url event type and the handler.

  • type (string) -- The only valid type is 'url'.
  • handler (function) -- A function that takes an event object of the type { url: string }. This handler should be the same function that you passed in to Linking.addEventListener.

Android only. Launch an Android intent with extras. Use IntentLauncher instead, sendIntent is only included in Linking for API compatibility with React Native's Linking API.

  • action (string) - The intent action, eg: 'android.settings.ACCESSIBILITY_SETTINGS'.
  • extras (array) - Extra data to pass in to the intent, each item in the area must be of type { key: string, value: string|number|boolean } .

Returns the initial URL followed by any subsequent changes to the URL.

An alias for Linking.useURL(). This method is deprecated and will be removed in a future SDK version.**
Returns the initial URL followed by any subsequent changes to the URL.