Deep linking working with adb, not in browser - android

I have setup deep linking in my app previously and had it work just fine. All the sudden it stops working. I have the below manifest...
<activity
android:name=".MainActivity"
android:launchMode="singleTask"
android:label="#string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https"
android:host="www.giftwizit.com" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="giftwi" android:host="Products" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
When I attempt to load https://www.giftwizit.com in a browser such as Chrome or even Samsung internet it simply loads up a google search page. The same happens when I attempt giftwi://Products.
What's interesting to me is when I run the adb command like...
all is good... the launcher shows up and asks which app I'd like to open the link with.
Now I am using app-auth, and I know that it has me make this entry into the build.gradle file, but I've had this before and had everything work just fine.
This snippet is from within the defaultConfig inside the build.gradle file, and is how the react-native-app-auth documentation says it should be. I just thought I'd include this to be as transparent as possible.
Hoping to get some help on this. I have noticed at least one other post where some guy was having the same problem years ago, but it hasn't received any answers.

The reason for not able to redirect while typing/pasting URL in your browser is due to a bug in Chrome browser itself. but that turned out to be an functionality and adopted by some other browsers as well
You can check the bug here, and look at the status: WontFix (Closed).
Now the reason behind all this according to them,
If a user typing/pasting URL in browser then the user really want to go that URL, instead being redirected on a application
So your deep linking is working fine, best way to test it, share the link and then click on it
And also this always redirection really caused problem as well, when user was not able to go on the website due to redirection, you can also check a bug report here due to this always redirection, status is now Fixed (Closed) for it

Related

Android AppLink prompting for app and chrome

I am trying to implement an AppLink (deeplink) such that when the app-link is triggered it does not bring up the popup asking for my App or Chrome, I want it to just launch my app so I can direct them to the proper place in the app.
I have read various android articles and posts and cannot get the AppLink to work the way I want.
Here is my manifest xml:
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="http"
android:host="www.example.com" />
</intent-filter>
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="https"
android:host="www.example.com" />
</intent-filter>
</activity>
I read in the android doc here the following:
A deep link is an intent filter that allows users to directly enter a
specific activity in your Android app. Clicking one of these links
might open a disambiguation dialog, which allows the user to select
one of multiple apps (including yours) that can handle the given URL.
For example, figure 1 shows the disambiguation dialog after the user
clicks a map link, asking whether to open the link in Maps or Chrome.
Android App Links are a special type of deep link that allows your
website URLs to immediately open the corresponding content in your
Android app (without requiring the user to select the app).
I added auto verify to the intent and have the assetlinks.json file but still prompts to choose my app or chrome. I DO NOT want the prompt for chrome... only my app.
So, what am I missing?
Has anyone here got an app link to work that DOES NOT pop up the option for Chrome?
Can anyone point me to a sample app or code or an article that actually works?
Thanks for any assistance with this.

Http deeplinks does not work in Chrome on Android

I would like to open an app (if its installed) when I click on the link on my webpage. I've implemented App Links according to official docs but the link is opened in Chrome and my app is not offered to handle the link. If I click on the link in Messages app for example, it works correctly. I think that it's some limitation of the Chrome but I cant find anything online about that. If I try to turn off the verification for App links and implement it just like regular deeplinks it does not work either. Do I need to implement Chrome Intent
s?
This is my intent filter
<activity
android:name=".MainActivity"
android:windowSoftInputMode="adjustNothing">
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="mydomain.com"
android:pathPattern="/.*/app-microsite"
android:scheme="http" />
<data
android:host="www.mydomain.com"
android:pathPattern="/.*/app-microsite"
android:scheme="http" />
<data android:scheme="https" />
</intent-filter>
</activity>
I'm putting the comment by Simon Marquis, that helped me, here as an answer to that question, so following visitors might see it more easily.
Deep links are not working if you're using relative links on the same domain.
E.g. you have this page: example.com/index.html
This will open in browser
This will open the app

Is there any way to know whether an Android App Link will open an app or not?

Is there a programmatic way to know whether a HTTPS URL will open an Android app using Android App Links?
For Universal Links, the iOS equivalent of App Links, one has the ability to use the static let universalLinksOnly: UIApplication.OpenExternalURLOptionsKey (documented here), when linking out to make sure that a URL will open an app or not. Is there an Android App Links equivalent for this?
<activity
android:name=".ui.activity.TestActivity"
android:label="#string/app_name"
android:launchMode="singleTask"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="testapp"
android:host="host1"
android:path="/path1"
android:port="8080" />
</intent-filter>
</activity>
Then:
Open from App
Among them, scheme and host are required, and other requirements depend on your actual needs.

Prevent Deeplink from being opened within the browser of the originating app

I am using Branch.io to Deeplink from the Salesforce App to my Cordova app. However, when I click the deeplink in the Salesforce app, it just opens my app within a browser inside the Salesforce app instead of actually taking me to my app. It seems like I should be using a <intent-filter/> to make that happen but it doesn't seem to be able to take me out of the originating Salesforce app. Here is what my <intent-filter/> currently is:
<intent-filter android:name="io.branch.sdk.UriScheme">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="myapp" />
</intent-filter>
<intent-filter android:autoVerify="true" android:name="io.branch.sdk.AppLink">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:host="myapp.app.link" android:scheme="https" />
</intent-filter>
What other intent actions or categories do I need there?
What actually definitively resolved this was going into the AndroidManifest.xml and setting android:launchMode="singleTask" on my main activity.
I know that in the android docs it says singleTask is not recommended. I believe that's because it prevents you from going back but we take over the functionality of the hardware back button so that's not relevant. Also according to this SO answer, it seems like the right thing to do in our context.
You should only need the intent filters listed here:
https://docs.branch.io/pages/apps/android/#configure-app
If it is opening your app within the Salesforce browser, then it may be that Salesforce is preventing users from deep linking out of it.

Making WebView a Default phone browsaer

I have been searching the web, and I still can’t find the answer. I have an Android app with a WebView, I am trying to make my activity the default browser for the phone. Therefore when I do a Google search in the Google search widget, it should pass the results into my WebView.
I am new to android development any examples would be highly grateful.
What I believe you are trying to ask is how to subscribe your application to intents for launching web URIs. In order to do so, you can add an intent filter to your application's manifest.
There's an example of this on Lars Vogel's blog. It boils down to this:
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".BrowserActivitiy"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="http"/>
</intent-filter>
</activity>
</application>

Categories

Resources