I have setup my React Native app to use Deep Linking with expo-linking, but for some reason it just does not work on Android (yet to implement on iOS). Opening the link just opens it in the web browser, and doesn't open the app as it should. Any idea why?
app.json
"android": {
"adaptiveIcon": {
"foregroundImage": "./assets/adaptive-icon.png",
"backgroundColor": "#FFFFFF"
},
"package": "com.example.myapp",
"intentFilters": [
{
"action": "VIEW",
"data": [
{
"scheme": "https",
"host": "testlink.com",
}
],
"category": [
"BROWSABLE",
"DEFAULT"
]
}
]
},
This did not update the AndroidManifest, so I manually edited it:
AndroidManifest.xml
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="https" android:host="testlink.com"/>
</intent-filter>
App.js
const linking = {
prefixes: ["https://testlink.com"],
};
useEffect(() => {
Linking.addEventListener("url", handleDeepLink);
return () => {
Linking.removeEventListener("url", handleDeepLink);
};
}, []);
return (
<NavigationContainer /*linking={linking}*/>
....
</NavigationContainer>
);
This worked fine with just the normal expo links, but is not working now I want a custom URL so that it opens in web browser on a computer, or on the app if it is installed.