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

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


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>


You need to consider various cases that may be applicable.

Please refer the intent-filters below. Also link is provided at the end.

<activity android:name="BrowserActivity"                  android:label="@string/application_name"                  android:launchMode="singleTask"                  android:alwaysRetainTaskState="true"                  android:configChanges="orientation|keyboardHidden"                  android:theme="@style/BrowserTheme"                  android:windowSoftInputMode="adjustResize" >            <intent-filter>                <action android:name="android.speech.action.VOICE_SEARCH_RESULTS" />                <category android:name="android.intent.category.DEFAULT" />            </intent-filter>            <!-- For these schemes were not particular MIME type has been                 supplied, we are a good candidate. -->            <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" />                <data android:scheme="about" />                <data android:scheme="javascript" />            </intent-filter>            <!--  For these schemes where any of these particular MIME types                  have been supplied, we are a good candidate. -->            <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" />                <data android:scheme="https" />                <data android:scheme="inline" />                <data android:mimeType="text/html"/>                <data android:mimeType="text/plain"/>                <data android:mimeType="application/xhtml+xml"/>                <data android:mimeType="application/vnd.wap.xhtml+xml"/>            </intent-filter>            <!-- We are also the main entry point of the browser. -->            <intent-filter>                <action android:name="android.intent.action.MAIN" />                <category android:name="android.intent.category.DEFAULT" />                <category android:name="android.intent.category.LAUNCHER" />                <category android:name="android.intent.category.BROWSABLE" />            </intent-filter>            <!-- The maps app is a much better experience, so it's not                 worth having this at all... especially for a demo!            <intent-filter android:label="Map In Browser">                <action android:name="android.intent.action.VIEW" />                <category android:name="android.intent.category.DEFAULT" />                <data android:mimeType="vnd.android.cursor.item/postal-address" />            </intent-filter>            -->            <intent-filter>                <action android:name="android.intent.action.WEB_SEARCH" />                <category android:name="android.intent.category.DEFAULT" />                <category android:name="android.intent.category.BROWSABLE" />                <data android:scheme="" />                <data android:scheme="http" />                <data android:scheme="https" />            </intent-filter>            <intent-filter>                <action android:name="android.intent.action.MEDIA_SEARCH" />                <category android:name="android.intent.category.DEFAULT" />            </intent-filter>            <intent-filter>                <action android:name="android.intent.action.SEARCH" />                <category android:name="android.intent.category.DEFAULT" />            </intent-filter>            <meta-data android:name="android.app.searchable"                    android:resource="@xml/searchable" />        </activity>