问题
I am using Android app, which is openned from chrome using Deeplink
,
1) Code of AndroidManifest.xml file, which opens myApp(React-Native) when I click deeplink in browser.
<intent-filter android:label="@string/app_name">
<data android:scheme="myapp"
android:host="myhost"
/>
</intent-filter>
2) url-link of browser, which opens app, by matching scheme://host, and I am passing URL's too, as:
<a href= "myapp://myhost/?name=gd">Open myApp</a>
3) I am using React-native, for getting those params as:
Linking.getInitialURL().then((url) => {
if (url) {
this.setState({
'opened_from_url': true,
'open_url': url
})
}
else
this.setState({
'opened_from_url': false
})
4) to goback to same page, from where I came in app is done as:
Linking.openURL(url).catch((err) => console.error('An error occurred', err));
But this opens app, in chrome/otherBrowsers as new-page, not same one,
5) How can come-back to same page, from where I came to app, without going in new-tab, implementing in core-java(AndroidManifest.xml) or react-native would be ok.
来源:https://stackoverflow.com/questions/59084609/deeplink-go-back-to-browser-from-myapp-after-clicking-back-button-in-android