Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add my browser in the default browser selection list in android?

Following the suggestions from How to add my browser in the default browser selection list in android?. I have specified my Intent in the manifest file:

<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="http"/> 
<data android:scheme="https"/> 
</intent-filter>

I have also added the permission:

<uses-permission android:name="android.permission.INTERNET"></uses-permission>

But still my browser is not showing in the default app options for the browser category in the settings.

Do I need to do anything else for my app to show up in the default options for browser?

like image 902
Gokul N K Avatar asked Nov 22 '18 08:11

Gokul N K


People also ask

What is the name of Android default browser?

For example, Android devices with stock OS usually come with Google Chrome set as their default browser but in brands like Samsung and Apple, the default browser is different. Apple phones use Safari as their default browser, whereas Samsung devices come pre-loaded with Samsung Internet Browser.

What is the meaning of default browser?

The default browser is the web browser that is automatically used when opening a web page or clicking on a web link.


1 Answers

Try to include the <category android:name="android.intent.category.BROWSABLE" /> in your target activity's intent-filter as developer documentation said:

If the user is viewing a web page or an e-mail and clicks on a link in the text, the Intent generated execute that link will require the BROWSABLE category, so that only activities supporting this category will be considered as possible actions.

It is required in order for the intent-filter to be accessible from a clickable link. Without it, clicking a link cannot resolve to your app.

<activity ...>

    <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" />
        <data android:scheme="https" />
    </intent-filter>

</activity>

.

Additional Tip: (If you want to force your app to be the default browser)

Android App Links on Android 6.0 (API level 23) and higher allow an app to designate itself as the default handler of a given type of link. If the user doesn't want the app to be the default handler, they can override this behavior from their device's system settings.

To enable link handling verification for your app, set android:autoVerify="true" in intent-filter tag:

<activity ...>

    <intent-filter android:autoVerify="true">

         ...

    </intent-filter>

</activity>
like image 180
aminography Avatar answered Oct 25 '22 23:10

aminography