Description::
I am working on react native app. My app is having login and signup page. After signup I am sending an email to user to verify account. User will get a link to verify account, after clicking on that link I am redirecting user to url where I am verifying him. Now I want to redirect the user inside "my app" verification screen if he is verifying using mobile phone.
How it's done using react native?
Here how I can move user inside "my app" after redirecting to email verification link?
I am using Deep Link concept to redirect user inside app. Step I have followed are mentioned below:
For Android::
I have added this inside AndroidManifest.xml file::
<activity
android:name=".MainActivity"
android:launchMode="singleTask"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:windowSoftInputMode="adjustResize">
and added data as follows::
<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="http"
android:host="myurl"
android:pathPrefix="/verify-email"/>
</intent-filter>
After this I have added this code inside my app.js file::
componentDidMount() {
console.log('hi');
Linking.addEventListener('url', this._handleOpenURL);
}
componentWillUnmount() {
Linking.removeEventListener('url', this._handleOpenURL);
}
_handleOpenURL(event) {
console.log('url', event.url);
When I am hitting this url "http://myurl/verify-email/demo" I am not getting any data in console and it's not opening my app. I am running my app on debug mode.
This is also possible with Firebase Dynamic Links, but can someone tell me which method is best among them?
And for "Firebase Dynamic Link" where should I add code to handle dynamic link throughout the app??