Make third party browser as default - android

Can anyone tell me how can we make our browser as default in Android? I want to do so that
when you open up the internet browser, it gives you two options: regular browser and Mybrowser (third party browser which is made by me). If you select the regular browser, it says that the phone cannot access the internet unless it is on the Mybrowser. Can we implement this feature, and how?

set this in your AndroidManifest.xml for your activity:
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.BROWSABLE"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:scheme="http" />
</intent-filter>

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.

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>

How to open an application from a URL?

My objective is to open my android application when user clicks link e.g I have shared specific item link (http://example.com/api_shirts.php?utmsource=shirt98) then if user have already installed my application then open it else where open it on browser.
I have searched a lot and get this but it's not working for me
<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="http"
android:host="www.example.com" />
<data android:scheme="https"
android:host="www.example.com"/>
</intent-filter>
I'm not sure if you may need to set a pathPrefix on this case. Also, the OS may open other prefered app that the user has set up as default app for that schema.
If I remember correcly you have to associate your app with your website so the OS can open the app directly bypassing the user's choice:
https://developer.android.com/studio/write/app-link-indexing.html#associatesite
Also, check https://developer.android.com/training/app-links/verify-site-associations.html to read about "deep links" vs "app links". You need app links for what you are trying to do.

How do I make my web browser app show up in "Open with..." when clicking a link?

When I click a link in something like Gmail, how can I have my web browser show up as an option to open said link? And what code would I implement to go about it? Even just a link to the correct documentation would be incredibly helpful.
Thanks!
You are probably missing to declare this <intent-filter> in your Manifest
<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="http"/>
</intent-filter>
For your app to be on the list of apps, you need an <intent-filter> that support web browsing. You can look at this link as a reference and determine what you need to add.

Open Android app from Chrome browser

I have been trying to make an app which opens automatically when a specific url is entered in the browser. To do so I've been using and intent filter within my manifest like so:
<intent-filter>
<data android:scheme="http" android:host="maltapark.com"/>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT"></category>
<category android:name="android.intent.category.BROWSABLE"></category>
</intent-filter>
This works fine but only in my default web browser. When I use chrome the app doesn't open.
I have also tried using firefox and it only opens my app with some but not all URLs such as abc://test.
Is there a way to get my app to open irrespective of the browser or URL being used please?
You could use the intent scheme, as explained here. The "Android Browser" may or may not support this, and you might have to rely on iframes. What FireFox does is anyone's guess, but personally I don't believe FireFox is a serious contender on the Android platform.
use this in manifest
<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:host="maltapark.com"
android:path="/"
android:scheme="TESTSCHEME" />
</intent-filter>
and use this in tag a
"intent://maltapark.com/#Intent;scheme=TESTSCHEME;package=com.YOURPACKAGENAME.www;end"
this is worked for me
What are the URL's you are trying to intercept with your app? You mentioned it doesn't work with something like abc://test, which is correct.
Your intent filter is declaring it wants to intercept urls that match http://maltapark.com.
If the url doesn't match that, it won't open.
try putting in the '*' wildcard in the andriod:scheme and maybe andriod:host attribute (if that is what you needed).

Categories

Resources