Android AppLink prompting for app and chrome - android

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.

Related

Android deep linking open all sub route in the except some specific sub routes

I added an intent filter in the app manifest and want to open all the links on the app except some specific links (that I want to open in the browser).
the manifest for deep linking:
<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="example.com" />
</intent-filter>
by this code, it opens the app for all links like https://example.com/* but for some specific sub-routes (mentioned below) I want to open the browser, not the app.
Sub routes that I want to open in the browser:
https://example.com/subroute1
https://example.com/subroute2
what is the solution to this issue?
I'm suing React-Native and React-Navigation.

Chrome Custom tab links does not launch the app, but mobile chrome browser does

I'm trying to launch my android application through a browser link.
When I open the link through the chrome browser, it successfully shows the App Dialog Picker which shows the app available for the scheme like this.
app dialog picker
But when the link is opened through the Chrome Custom tab,
it just redirects to the site without showing the App Dialog Picker.
I need it to launch the app or show the dialog picker when the link is opened from another app (like gmail) which opens the in-app browser and not just in the chrome browser.
here is the current intent-filter I have.
<intent-filter>
<data
android:scheme="http"
android:host="www.myapp.com" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
If anyone could point out would be a great help. Thanks
So if ever anyone encounters the same problem, here's what I did. To launch your app with Chrome Custom Tabs browser, you need to make your scheme a non web-link format and make it into a custom scheme (example below). Because apparently, Chrome Custom tabs considers web link schemes as an ordinary link therefore launching it in the browser.
so from
<intent-filter>
<data
android:scheme="http"
android:host="www.myapp.com" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
change the scheme to a custom one, that way, your app's scheme will be the only one that gets handled by the browser. This is an example link with the scheme given below ~ myapp://myapp.app (note that this link is not clickable in android apps, but you can place it in the href of the html anchor tag of your website).
<intent-filter>
<data
android:scheme="myapp"
android:host="myapp.app" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>

Messages app do not recognize my deep links schemas

I'm implementing a share feature in my app, the user will be able to share a deep link via sms or any other message app.
The issue I'm facing is that the Phone's message app does not recognize the generated deep link as a link.
I have on the manifest file the intent filter with the scheme and host declared. Also I was able test the deep link from a push notification, that means the manifest configuration works. However, I can't tap the message app deep link and open my app.
<activity
android:name=".activities.DailyGiveawayActivity"
android:launchMode="singleTop"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateAlwaysHidden">
<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="${schemeBU}${schemeEnv}"
tools:ignore="AppLinkUrlError" />
<data
android:host="GiveawayRegistration"
tools:ignore="AppLinkUrlError" />
</intent-filter>
</activity>
Solved this issue using the Android App Link API.
https://developer.android.com/studio/write/app-link-indexing.html.
Using the fallowing intent filter my code is working and the OS knows how to handle the generated URL (even when doesn't exist). The OS will prompt a dialog, the user will have to pick an app capable to manage this url (browsers and my app), but that is good for now. Next stage will be eliminate this steep.
<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="${schemeBU}${schemeEnv}"
android:pathPattern="/Register" />
</intent-filter>

How do I open a link from an NFC tag?

I want to write a NFC tag that opens a specific note in Google Keep when touched.
I have an URL in the form of https://keep.google.com/u/0/#LIST/<id> that does the desired action of opening the note in the installed Google Keep app on my phone when I read it with a QR-reader or click on it as a link.
When I write this URL to the tag an touch the tag afterwards, it opens in the browser. Is the NFC handler skipping other apps and opening it directly in a browser? When I clear the app-defaults for the browser, it shows a selection menu for the installed browsers after tapping the tag. Does anyone have an idea what I am doing wrong?
Links on NFC tags are not launched as intents with the typical VIEW action. Consequently, other apps may not pick those links up correctly and you will instead experience the web browser to be opened. Only apps that specifically register for the intent action NDEF_DISCOVERED will be able to receive links from NFC tags. It seems that Google Keep currently does not do this, so there's not much you can do without creating your own wrapper app that handles these URLs and passes them on to Google Keep.
You should enable deeplinks in your activity. Also you should indicate your activity NFC tag discoverable as follows. You can learn anything about deep linking via this link
<activity
android:name="ExampleActivity"
android:label="Example">
<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="example.com"
android:scheme="http" />
<data android:scheme="https" />
</intent-filter>
<intent-filter>
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
</activity>

How to open my application directly by clicking on a link from mail?

I am looking for a solution so far, i.e When user clicks on a link from his mail box My Application should open if My Application is already installed in his device without asking user to choose options with Just Once and Always .For example, clicking a URI in an email from a bank might result in a dialog asking the user whether to use the browser, or the bank's own app, to open the link, But in my case my application should open directly without asking to choose any option.
I have implemented my application as follows:
My manifest file as AndroidManifest.xml
<activity android:name=".WelcomeActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.VIEW"></action>
<category android:name="android.intent.category.DEFAULT"></category>
<category android:name="android.intent.category.BROWSABLE"></category>
<data android:host="www.example.com"
android:scheme="http"
android:pathPrefix="/blog"></data>
</intent-filter>
</activity>
My example url is http://www.example.com/blog
I would like to open my application if user clicks on above link.
Please help me with sample code with steps.
This feature is only available on Android devices running at least Marshmallow (6+) and is referenced as App Link throughout the Android documentation.
To fully implement this feature, it requires you to own the corresponding url and add a configuration file at this address: https://www.example.com/.well-known/assetlinks.json. The file content is described in the documentation (contains the package name and its signature).
Then, modify your intent-filter as follow to enable the auto-verify feature:
<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" android:pathPrefix="/blog" />
</intent-filter>
You should definitely read the documentation about this feature. It contains a lot of usefuls tips to test your implementation.

Categories

Resources