Skip to content

Commit bfff3fa

Browse files
add more information about deep link for expo projects
1 parent 6006881 commit bfff3fa

File tree

4 files changed

+168
-3
lines changed

4 files changed

+168
-3
lines changed

docs/deep-linking.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,50 @@ const SimpleApp = createAppContainer(createStackNavigator({...}));
4040
// on Android, the URI prefix typically contains a host in addition to scheme
4141
// on Android, note the required / (slash) at the end of the host property
4242
const prefix = Platform.OS == 'android' ? 'mychat://mychat/' : 'mychat://';
43+
// in Expo projects you can do the following to get the URI prefix
44+
const prefix = Expo.Linking.makeUrl('/');
4345

4446
const MainApp = () => <SimpleApp uriPrefix={prefix} />;
4547
```
4648

4749
## Set up with Expo projects
4850

51+
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:
52+
53+
```json
54+
{
55+
"expo": {
56+
"scheme": "mychat"
57+
}
58+
}
59+
```
60+
### iOS
61+
62+
To test the URI on the simulator (Expo client app ), run the following:
63+
64+
```
65+
xcrun simctl openurl booted [ put your URI prefix in here ]
66+
67+
// for example
68+
69+
xcrun simctl openurl booted exp://127.0.0.1:19004/--/chat/Eric
70+
71+
```
72+
73+
74+
### Android
75+
76+
To test the intent handling in Android (Expo client app ), run the following:
77+
78+
```
79+
adb shell am start -W -a android.intent.action.VIEW -d "[ put your URI prefix in here ]" com.simpleapp
80+
81+
// for example
82+
83+
adb shell am start -W -a android.intent.action.VIEW -d "exp://127.0.0.1:19004/--/chat/Eric" com.simpleapp
84+
85+
```
86+
4987
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.
5088

5189
## Set up with `react-native init` projects

website/versioned_docs/version-1.x/deep-linking.md

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,52 @@ Next, let's configure our navigation container to extract the path from the app'
3939
const SimpleApp = StackNavigator({...});
4040

4141
// on Android, the URI prefix typically contains a host in addition to scheme
42+
// on Android, note the required / (slash) at the end of the host property
4243
const prefix = Platform.OS == 'android' ? 'mychat://mychat/' : 'mychat://';
44+
// in Expo projects you can do the following to get the URI prefix
45+
const prefix = Expo.Linking.makeUrl('/');
4346

4447
const MainApp = () => <SimpleApp uriPrefix={prefix} />;
4548
```
4649

4750
## Set up with Expo projects
4851

52+
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:
53+
54+
```json
55+
{
56+
"expo": {
57+
"scheme": "mychat"
58+
}
59+
}
60+
```
61+
### iOS
62+
63+
To test the URI on the simulator (Expo client app ), run the following:
64+
65+
```
66+
xcrun simctl openurl booted [ put your URI prefix in here ]
67+
68+
// for example
69+
70+
xcrun simctl openurl booted exp://127.0.0.1:19004/--/chat/Eric
71+
72+
```
73+
74+
75+
### Android
76+
77+
To test the intent handling in Android (Expo client app ), run the following:
78+
79+
```
80+
adb shell am start -W -a android.intent.action.VIEW -d "[ put your URI prefix in here ]" com.simpleapp
81+
82+
// for example
83+
84+
adb shell am start -W -a android.intent.action.VIEW -d "exp://127.0.0.1:19004/--/chat/Eric" com.simpleapp
85+
86+
```
87+
4988
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.
5089

5190
## Set up with `react-native init` projects
@@ -94,11 +133,15 @@ To configure the external linking in Android, you can create a new intent in the
94133
In `SimpleApp/android/app/src/main/AndroidManifest.xml`, add the new `VIEW` type `intent-filter` inside the `MainActivity` entry:
95134

96135
```
136+
<intent-filter>
137+
<action android:name="android.intent.action.MAIN" />
138+
<category android:name="android.intent.category.LAUNCHER" />
139+
</intent-filter>
97140
<intent-filter>
98141
<action android:name="android.intent.action.VIEW" />
99142
<category android:name="android.intent.category.DEFAULT" />
100143
<category android:name="android.intent.category.BROWSABLE" />
101-
<data android:scheme="mychat" android:host="mychat" />
144+
<data android:scheme="mychat" android:host="mychat" />
102145
</intent-filter>
103146
```
104147

website/versioned_docs/version-2.x/deep-linking.md

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,50 @@ const SimpleApp = createStackNavigator({...});
4141
// on Android, the URI prefix typically contains a host in addition to scheme
4242
// on Android, note the required / (slash) at the end of the host property
4343
const prefix = Platform.OS == 'android' ? 'mychat://mychat/' : 'mychat://';
44+
// in Expo projects you can do the following to get the URI prefix
45+
const prefix = Expo.Linking.makeUrl('/');
4446

4547
const MainApp = () => <SimpleApp uriPrefix={prefix} />;
4648
```
4749

4850
## Set up with Expo projects
4951

52+
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:
53+
54+
```json
55+
{
56+
"expo": {
57+
"scheme": "mychat"
58+
}
59+
}
60+
```
61+
### iOS
62+
63+
To test the URI on the simulator (Expo client app ), run the following:
64+
65+
```
66+
xcrun simctl openurl booted [ put your URI prefix in here ]
67+
68+
// for example
69+
70+
xcrun simctl openurl booted exp://127.0.0.1:19004/--/chat/Eric
71+
72+
```
73+
74+
75+
### Android
76+
77+
To test the intent handling in Android (Expo client app ), run the following:
78+
79+
```
80+
adb shell am start -W -a android.intent.action.VIEW -d "[ put your URI prefix in here ]" com.simpleapp
81+
82+
// for example
83+
84+
adb shell am start -W -a android.intent.action.VIEW -d "exp://127.0.0.1:19004/--/chat/Eric" com.simpleapp
85+
86+
```
87+
5088
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.
5189

5290
## Set up with `react-native init` projects
@@ -95,11 +133,15 @@ To configure the external linking in Android, you can create a new intent in the
95133
In `SimpleApp/android/app/src/main/AndroidManifest.xml`, add the new `intent-filter` inside the `MainActivity` entry with a `VIEW` type action:
96134

97135
```
136+
<intent-filter>
137+
<action android:name="android.intent.action.MAIN" />
138+
<category android:name="android.intent.category.LAUNCHER" />
139+
</intent-filter>
98140
<intent-filter>
99141
<action android:name="android.intent.action.VIEW" />
100142
<category android:name="android.intent.category.DEFAULT" />
101143
<category android:name="android.intent.category.BROWSABLE" />
102-
<data android:scheme="mychat" android:host="mychat" />
144+
<data android:scheme="mychat" android:host="mychat" />
103145
</intent-filter>
104146
```
105147

website/versioned_docs/version-3.x/deep-linking.md

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,50 @@ const SimpleApp = createAppContainer(createStackNavigator({...}));
4141
// on Android, the URI prefix typically contains a host in addition to scheme
4242
// on Android, note the required / (slash) at the end of the host property
4343
const prefix = Platform.OS == 'android' ? 'mychat://mychat/' : 'mychat://';
44+
// in Expo projects you can do the following to get the URI prefix
45+
const prefix = Expo.Linking.makeUrl('/');
4446

4547
const MainApp = () => <SimpleApp uriPrefix={prefix} />;
4648
```
4749

4850
## Set up with Expo projects
4951

52+
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:
53+
54+
```json
55+
{
56+
"expo": {
57+
"scheme": "mychat"
58+
}
59+
}
60+
```
61+
### iOS
62+
63+
To test the URI on the simulator (Expo client app ), run the following:
64+
65+
```
66+
xcrun simctl openurl booted [ put your URI prefix in here ]
67+
68+
// for example
69+
70+
xcrun simctl openurl booted exp://127.0.0.1:19004/--/chat/Eric
71+
72+
```
73+
74+
75+
### Android
76+
77+
To test the intent handling in Android (Expo client app ), run the following:
78+
79+
```
80+
adb shell am start -W -a android.intent.action.VIEW -d "[ put your URI prefix in here ]" com.simpleapp
81+
82+
// for example
83+
84+
adb shell am start -W -a android.intent.action.VIEW -d "exp://127.0.0.1:19004/--/chat/Eric" com.simpleapp
85+
86+
```
87+
5088
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.
5189

5290
## Set up with `react-native init` projects
@@ -95,11 +133,15 @@ To configure the external linking in Android, you can create a new intent in the
95133
In `SimpleApp/android/app/src/main/AndroidManifest.xml`, add the new `intent-filter` inside the `MainActivity` entry with a `VIEW` type action:
96134

97135
```
136+
<intent-filter>
137+
<action android:name="android.intent.action.MAIN" />
138+
<category android:name="android.intent.category.LAUNCHER" />
139+
</intent-filter>
98140
<intent-filter>
99141
<action android:name="android.intent.action.VIEW" />
100142
<category android:name="android.intent.category.DEFAULT" />
101143
<category android:name="android.intent.category.BROWSABLE" />
102-
<data android:scheme="mychat" android:host="mychat" />
144+
<data android:scheme="mychat" android:host="mychat" />
103145
</intent-filter>
104146
```
105147

0 commit comments

Comments
 (0)