Reputation: 157
In react-native, I am trying to log in the user using facebook/Google.
I am opening the URL in external browser, after entering credentials, It redirects back to app where, I have added an event
componentDidMount() {
Linking.addEventListener('url', this._handleOpenURL);
}
In iOS, it is working fine. But on Android, this never gets called.
I read somewhere that Linking works only with In app browser, I have also tried that, but Google does not allow that also. Attaching the image for that error please have a look also:
I have also gone through and alerted componentWillMount(), componentDidMount(), componentWillUpdate(), componentWillUnmount(), componentWillReceiveNewProps(), and _handleOpenURL() and I get nothing when I click the link and it "re-opens" the app from the background? What am I doing wrong?
Can any body help me please. I need extreme help. I am stuck here.
Please guide me how to catch URL callback for android in React-Native.
Thanks.
Upvotes: 2
Views: 3459
Reputation: 157
In android we have to mention the launch mode as singleTask for the activity to restrict it to load only once.
Add this line for the activity that will be opened against this redirection:
android:launchMode="singleTask"
I had added this to application tag. which is wrong. It should be with activity tag.
Upvotes: 3