Linking
Projects with Native Code Only
The following section only applies to projects with native code exposed.
Linking
gives you a general interface to interact with both incoming and outgoing app links.
Custom URL scheme isn't the only way to open your application on mobile. You don't want to use a custom URL scheme in links in the email because then the links would be broken on desktop. Instead, you want to use a regular https
links such as https://www.myapp.io/records/1234546
. Android calls it Deep Links (Universal Links - iOS).
Built-in URL Schemes
As mentioned in the introduction, there are some URL schemes for core functionality that exist on every platform. The following is a non-exhaustive list, but covers the most commonly used schemes.
Scheme | Description | iOS | Android | Kepler |
---|---|---|---|---|
mailto |
Open mail app, e.g., mailto:support@amazon.com |
✅ | ✅ | ❌ |
tel |
Open phone app, e.g., tel:+123456789 |
✅ | ✅ | ❌ |
sms |
Open SMS app, e.g., sms:+123456789 |
✅ | ✅ | ❌ |
{http/https}://<host>[<path>][?query_params] |
Open web browser app, e.g., https://amazon.com |
✅ | ✅ | ✅ |
pkg://<component-id> |
Allows you to directly address lifecycle components by name, e.g., pkg://com.amazon.lcm.test.main |
❌ | ❌ | ✅ |
os://<use-case>[<sub-page>] |
Offers a platform-independent method for accessing core OS functions, e.g., os://settings/wifi |
❌ | ❌ | ✅ |
{amzns/amzn}://apps[/path]?<identifier_type>=<identifier_value> |
Used by the package manager to launch an app via identifier, e.g., amzns://apps?asin=ABCD1234 |
❌ | ❌ | ✅ |
<custom-scheme>://[<host>[<path>]][?query_params] |
App-defined schemes for launching apps from another app/site, e.g., livetv://watchnow |
✅ | ✅ | ✅ |
broadcast://*/<reverse-dns-namespace>/<topic>/<sub-topic> |
Event topic for publishing messages to all subscribers, e.g., broadcast://*/com.amazon.idle/state/idle/screensaver |
❌ | ❌ | ✅ |
unicast://*/<reverse-dns-namespace>.<topic>/<sub-topic> |
Event topic for publishing messages to specific subscriber subsets, e.g., unicast://*/com.amazon.push-service/force-ota |
❌ | ❌ | ✅ |
fos://<package-id>[<scheme>[<host>[<path>]]][#<intent-fragment>] |
Intent-style URIs, e.g., fos://com.netflix#Intent;action=OPEN_NETFLIX_ACTION;end; |
❌ | ❌ | ✅ |
Enabling Deep Links
To enable a component to receive messages from another app and map the message target URI, set the launch-uris
in the manifest.toml
file.
[[offers.interaction]]
id = "com.amazon.ambienthome.screensaver"
launch-uris = ["os://ambient-component", "tahoe://main", "os://home", "amzns://apps"]
Handling Deep Links
There are two ways to handle URLs that open your app.
-
If the app is already open, the app is foregrounded and a Linking 'url' event is fired
You can handle these events with
Linking.addEventListener('url', callback)
- it callscallback({url})
with the linked URL -
If the app is not already open, it is opened and the url is passed in as the initialURL
You can handle these events with
Linking.getInitialURL()
- it returns a Promise that resolves to the URL, if there is one.
Parameters:
Name | Type | Description |
---|---|---|
url Required | string | The URL to open. |
getInitialURL()
static getInitialURL(): Promise<string | null>;
If the app launch was triggered by an app link, it will give the link url, otherwise it will give null
.
getInitialURL()
can return null
when debugging is enabled. Disable the debugger to ensure it gets passed.
openSettings()
static openSettings(): Promise<void>;
Open the Settings app and displays the app’s custom settings, if it has any.
openURL()
static openURL(url: string): Promise<any>;
Try to open the given url
with any of the installed apps.
The method returns a Promise
object. If the user confirms the open dialog or the url automatically opens, the promise is resolved. If the user cancels the open dialog or there are no registered applications for the url, the promise is rejected.
Parameters:
Name | Type | Description |
---|---|---|
url Required | string | The URL to open. |
This method will fail if the system doesn't know how to open the specified URL. If you're passing in a non-http(s) URL, it's best to check
canOpenURL()
first.
Last updated: Sep 30, 2025