I am on Android and I want to use DeepLink to open a specific screen using react navigation.
Here is my manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.samtbook">
<application
android:name=".MainApplication"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:allowBackup="false"
android:theme="@style/AppTheme"
android:supportsRtl="false"
android:usesCleartextTraffic="true"
>
<activity
android:launchMode="singleTask"
android:name=".MainActivity"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="http" android:host="samtbook.me"/>
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity"/>
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="API_KET"/> // HIDDEN
</application>
and here is the link I use:
http://samtbook.me/test/
and I registered my deepLink like this:
componentDidMount() {
Linking.addEventListener('url', this.handleOpenURL);
}
componentWillUnmount() {
Linking.removeEventListener('url', this.handleOpenURL);
}
handleOpenURL = (event) => {
this.navigate(event.url);
};
navigate = (url) => {
this.props.navigation.navigate('TestScreen');
};
The poblem is When the app is not running in the background(Means dead) I click over the link and it opens the app but not navigate to intended screen but when the app is running in background it navigates
Thanks in advance