Deeplink: go-back to browser from myApp, after clicking back-button in android, react-native

杀马特。学长 韩版系。学妹 提交于 2020-01-24 00:58:40

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!