Reputation: 17383
I'm following this tutorial:
https://medium.com/react-native-training/deep-linking-your-react-native-app-d87c39a1ad5e
but my app doesn't lunched when I type this url at browser:
peopleapp://people/0
my manifest.xml
:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="*.*.*"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.READ_PROFILE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<application
android:name=".MainApplication"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:allowBackup="false"
android:largeHeap="true"
android:theme="@style/AppTheme"
android:supportsRtl="false"
android:screenOrientation="portrait"
tools:replace="android:supportsRtl">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
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:label="filter_react_native">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="peopleapp" android:host="people" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
<service android:name="io.invertase.firebase.messaging.RNFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<service android:name="io.invertase.firebase.messaging.RNFirebaseInstanceIdService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
</intent-filter>
</service>
<meta-data
android:name="com.google.firebase.messaging.default_notification_channel_id"
android:value="teamcide"/>
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="AIzaSyDpiU78-****S6Lvllgqo"/>
</application>
</manifest>
Upvotes: 6
Views: 23950
Reputation: 2638
Hii you can use following code to open specific url in react native
const url = 'whatsapp://';
Linking.canOpenURL(url)
.then(supported => {
if (!supported) {
console.log('Can\'t handle url: ' + url);
} else {
return Linking.openURL(url);
}
}).catch(err => console.error('An error occurred', err));
Or you can also check this url for more information
Upvotes: 2
Reputation: 28539
There is a small quirk with Android and deep links and that is putting the link in your browser won't work. There are a couple of ways that you can open the link.
In the tutorial it says the following about opening it on an Android device:
That is all we need as far as configuration goes. To test this out, open Android Studio. Open Run -> Edit Configurations and change the launch options to URL, passing in the following url: peopleapp://people/1
You can use the following app to open your deep links https://play.google.com/store/apps/details?id=com.manoj.dlt
You can create a small webpage with your deep link contained inside an href
<a href="peopleapp://people/0">open people 0</a>
And then browse to that page and click your link.
Upvotes: 3