Android Question [SOLVED] How to determine default browser on device - WITHOUT using android.permission.QUERY_ALL_PACKAGES

JackKirk

Well-Known Member
Licensed User
Longtime User
I recently worked out how to use Erel's 2011 code:

https://www.b4x.com/android/forum/t...-a-particular-type-of-intent.13580/post-76825

to determine the default browser in use on an Android device - see:

https://www.b4x.com/android/forum/threads/solved-how-to-determine-default-browser-on-device.162506/

Unfortunately this seemed to require android.permission.QUERY_ALL_PACKAGES in the B4A project manifest.

This is now heavily frowned upon by Google:

https://support.google.com/googleplay/android-developer/answer/10158779

which probably means for most practical purposes you are not going to get the B4A app published.

I looked all over for a solution to this and eventually found it by asking Windows Copilot - of which I am becoming a huge fan.

I asked it:
how do i use android manifest <queries> to enable querying of all possible browsers
(I had already worked out that <queries> may be the answer).

It responded with (copy paste does not do it's response layout justice):
Which is encouraging but I need it in B4A Manifest form so I then asked it:
how would i add this to a b4a manifest
It responded with:
So I added:
B4X:
AddManifestText(
<queries>
    <intent>
        <action android:name="android.intent.action.VIEW" />
        <data android:scheme="http" />
    </intent>
    <intent>
        <action android:name="android.intent.action.VIEW" />
        <data android:scheme="https" />
    </intent>
</queries>)
to my B4A project manifest and removed the android.permission.QUERY_ALL_PACKAGES - and it all works!!!!!
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…