Skip to content

Commit cdb636d

Browse files
authored
Update deep-linking.md
1 parent 9bb8d1f commit cdb636d

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

docs/deep-linking.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const SimpleApp = createAppContainer(createStackNavigator({
3131

3232
## Set up with Expo projects
3333

34-
You need to specify a scheme for your app. You can register for a scheme in your `app.json` by adding a string under the scheme key:
34+
First, you will want to specify a url scheme for your app. This corresponds to the string before `://` in a url, so if your scheme is `mychat` then a link to your app would be `mychat://`. The scheme only applies to standalone apps and you need to re-build the standalone app for the change to take effect. In the Expo client app you can deep link using `exp://ADDRESS:PORT` where `ADDRESS` is often `127.0.0.1` and `PORT` is often `19000` - the URL is printed when you run `expo start`. If you want to test with your custom scheme you will need to run `expo build:ios -t simulator` or `expo build:android` and install the resulting binaries in your emulators. You can register for a scheme in your `app.json` by adding a string under the scheme key:
3535

3636
```json
3737
{
@@ -41,33 +41,36 @@ You need to specify a scheme for your app. You can register for a scheme in your
4141
}
4242
```
4343

44+
4445
### URI Prefix
4546

4647
Next, let's configure our navigation container to extract the path from the app's incoming URI.
4748

4849
```js
50+
import * as Expo from 'expo';
51+
4952
const SimpleApp = createAppContainer(createStackNavigator({...}));
5053

5154
const prefix = Expo.Linking.makeUrl('/');
5255

5356
const MainApp = () => <SimpleApp uriPrefix={prefix} />;
5457
```
5558

56-
### iOS
59+
The reason that is necessary to use `Expo.Linking.makeUrl` is that the scheme will differ depending on whether you're in the client app or in a standalone app.
60+
61+
### Test deep linking on iOS
5762

58-
To test the URI on the simulator (Expo client app ), run the following:
63+
To test the URI on the simulator in the Expo client app, run the following:
5964

6065
```
6166
xcrun simctl openurl booted [ put your URI prefix in here ]
6267
6368
// for example
6469
65-
xcrun simctl openurl booted exp://127.0.0.1:19004/--/chat/Eric
66-
70+
xcrun simctl openurl booted exp://127.0.0.1:19000/--/chat/Eric
6771
```
6872

69-
70-
### Android
73+
### Test deep linking on Android
7174

7275
To test the intent handling in Android (Expo client app ), run the following:
7376

@@ -76,8 +79,7 @@ adb shell am start -W -a android.intent.action.VIEW -d "[ put your URI prefix in
7679
7780
// for example
7881
79-
adb shell am start -W -a android.intent.action.VIEW -d "exp://127.0.0.1:19004/--/chat/Eric" com.simpleapp
80-
82+
adb shell am start -W -a android.intent.action.VIEW -d "exp://127.0.0.1:19000/--/chat/Eric" com.simpleapp
8183
```
8284

8385
Read the [Expo linking guide](https://docs.expo.io/versions/latest/guides/linking.html) for more information about how to configure linking in projects built with Expo.

0 commit comments

Comments
 (0)