Android Deep linking is intermittent - android

We have an Andriod app from where we are starting a brower experiance and loading a page.
On the browser page their are two buttons "Agree" and "Cancel". We have a deep link URL which is being called on click of both buttons and take user back to the app from where the journey started.
Only difference in the functionality is on click of "Agree" we are doing backed calls and after we get response which is taking around 10-15 seconds we are just redirecting chrome to deep link url.
"Cancel" is working seem-less, but on click of "Agree" button browser is not able to understand deep-link url and doing the redirect in same browser session.
This is how we are redirecting chrome to deep-link url.
window.location.replace(redirectUrl);

Here is the conclusion from our debugging. We found out that there is nothing missing in the code.
Chrome doesn’t launch an external app for a given Intent URI in the following cases.
When the Intent URI is redirected from a typed in URL.
When the Intent URI is initiated without user gesture.
On click of Cancel button it is working all the time as there is no backend call.
On Agree button we are calling backend and on completion of a promise we are redirecting back to App. In that scenario chrome is not treating this as a user gesture all the time so failing intermittently.
One way to solve this issue is instead of opening a new browser window open experience in Android WebView.

Related

After processing a deep link inside the app, redirect user back to the browser

React Native [Ejected Expo Project]
I'm trying to redirect a user back to the browser after processing a deep link inside the Android app. Is there any common method for switching a user back to one app under (previously active/opened) the currently running up?
For example:
After activating deep link from Opera Browser, my app starts
I'm processing that request inside the app
I'm moving my app to the background and bringing back Opera to the foreground
I was playing around with React Native Linking but it opens either default browser or Google Chrome, depending on a custom URL Scheme. Because I couldn't find a way to open other browsers the same way I open Chrome (googlechrome://), my last hope is to find a way to switch back to a browser that triggered my deep link.
Trusona & Freja eID are apps doing exactly what I want. After authorization attempt approval on your mobile device, you're redirected back (you can even see, that transition between app and browser is in a "back manner") to the original browser from which you started authorization process.
Thank you!

Branch.io: Deeplinking goes to custom URL on return

In Branch.io, I created a branch and posted the link to Facebook successfully. Here is my configuration on branch.io dashboard:
This is the link on facebook:
I click on it, it redirects me to my app successfully. Within a few seconds of the bottom screen appear, my app starts:
Now, I return to facebook by closing my app and starting facebook - the facebook built in browser seems to be continuing with going to the custom URL of (www.yahoo.com):
Within a few seconds, yahoo opens:
I would have thought that once the redirect was successful, the Facebook built-in browser would have closed and when you return to facebook, facebook would appear. I would not have expected the built-in browser to continue with the custom url as though your app was not installed.
Is there a fix for this?
If you check in the settings for Facebook you will see by default, Links Open externally is set to off.
This is definitely a nuisance when it comes to deep links especially from Facebook.
I have never used branch.io but i am assuming it is able to intercept this behavior of the deeplink open the link externally, but this does not stop Facebook from trying to render in the browser without this turned off. And it is probably unrealistic to think your users will all have this turned off by default.
But for testing now, i would turn Links Open externally to on, and see if for the time being it helps stop the issue.

Redirect from Mozilla Firefox to Android app - Deep Linking

I use an intent filter to allow deep linking to an activity of my application.
Like in the example given below:
https://developer.android.com/training/app-indexing/deep-linking.html
The redirection to my app works fine with Google Chrome and the Android Browser but when i use Firefox, the problem is that Firefox launches a new instance of my app, instead of redirecting me to the already launched instance of the app. Moreover the new launhed app seems to be running through Firefox.
The senario is the following:
1) I launch my app. If the user has forgot his credentials i send him an email.
2) The user goes to his email app.
3) In the email i sent to the user, there is an account activation link which also redirects him back to the application.
What could be wrong with Firefox?
Thank you in advance!
According to This Post, Firefox implements a less invasive experience to the user. When an url is opened which has a deep link to an app, the url bar displays a page action with a little Android head. Clicking on this one will open the link with an Android activity other than a browser.
The behavior of the Android browser and Chrome you observed and made your expectation.

How to detect from which app a user returned to your app?

A user presses on a URL in my app and the URL opens in the mobile browser.
Is it possible that I detect in my app when a user returned from the mobile browser to my app?
Many users will simply read the content of URL and press back to return to my app.
Test case:
user clicks on URL
mobile browser opens the URL
user touches BACK button
app detects that user came back to the app from the mobile browser
If I did not explain this well, please let me know.
I would suggest that you launch the URL with startActivityForResult. Then, when the user returns to your application onActivityResult will be called, and if the RequestCodes align you know it is the web browser.
For more information, take a look at this:
http://developer.android.com/reference/android/app/Activity.html#StartingActivities

How do I remove the browser from the activity stack if it launches my Activity?

We have been working on ways to launch our application from links in Email messages, and we have something that works pretty well. Only URLs with http/https schemes work properly, so we have written a small 'redirector' in our server application that sees we are coming from an Android browser and redirects to a URI with a scheme that our application launches. All of this is working pretty well.
The only bad part is because the browser is launched between clicking the link in the email, and the Application popping up due to the redirect, when the user hits the back button to go back to their email program after using our application, the browser is shown to the user. The browser is left on a blank page, and the user could become confused by this and not know to press the back button again to get back to their email.
When our application is launched from the link the browser will handle the URL and the redirect will cause our application to appear as usual. However, is there a way inside my application to tell Android that my application effectively replaces the browser on the back stack, so that if the back button is pressed, the user goes back to the Email program as if the browser didn't pop up in the first place?
Thanks in advance.
You can skip the entire browser in the middle by using an intent filter. You can register a specific schema to listen for and a given url to launch the application. This will launch your application directly and not put a browser in the middle. The YouTube application uses a method similar I'm sure to open the video directly in the YouTube application. This is a question that might point you in a good direction for implementing this.

Categories

Resources