Reputation: 870
I'm trying to find a solution for the following use case. On our website, we have a deeplink, by clicking which customer should be either redirected to our app if it's installed or to another web page in the browser (according to the link). What I'm trying to achieve here is to return back to the browser page after the deeplink is handled by our app.
I can technically try to launch an Intent with the URL of the page, but unfortunately, it does not guarantee that we'd return back to the page where the deeplink was clicked, and also the system might ask us to select an app for opening a URL (if it's not set by default). Another problem here is that the link might be opened in a new tab, which is also not very nice.
Is there any way to achieve this?
Upvotes: 1
Views: 2656
Reputation: 71
I had similar task and these steps helped me.
- android-app://com.opera.browser
- android-app://org.mozilla.firefox
- android-app://com.android.chrome
Then extract package name, com.opera.browser
for example, and create intent for it with getLaunchIntentForPackage.
Then add Intent.FLAG_ACTIVITY_REORDER_TO_FRONT
flag to just created intent. I'm not sure that this step is necessary.
Then startActivity with created intent.
Upvotes: 1