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:
It responded with (copy paste does not do it's response layout justice):
to my B4A project manifest and removed the android.permission.QUERY_ALL_PACKAGES - and it all works!!!!!
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:
(I had already worked out that <queries> may be the answer).how do i use android manifest <queries> to enable querying of all possible browsers
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:To enable querying of all possible browsers in your Android app, you can use the <queries> element in your AndroidManifest.xml file. This element allows your app to specify the set of other apps it intends to interact with, which is necessary for package visibility starting from Android 11 (API level 30).
Here’s an example of how you can configure the <queries> element to query for browsers:
XML
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myapp">
<queries>
<!-- Query for all browsers -->
<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>
<!-- Other manifest entries -->
</manifest>
AI-generated code. Review and use carefully. More info on FAQ.
In this example:
This configuration ensures that your app can query for any installed browser that can handle HTTP and HTTPS URLs12.
- The <queries> element contains two <intent> elements.
- Each <intent> element specifies an action (android.intent.action.VIEW) and a data scheme (http and https), which are common schemes handled by browsers.
If you have any more questions or need further assistance, feel free to ask!
It responded with:how would i add this to a b4a manifest
So I added:To add the <queries> element to your B4A (Basic4Android) manifest, you can use the AddManifestText method. Here’s how you can do it:
AddManifestText(<queries>
- Open your B4A project.
- Go to the Manifest Editor.
- Add the following code to include the <queries> element:
<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>)
This code snippet ensures that your app can query for all browsers that handle HTTP and HTTPS URLs1.
If you encounter any issues or need further assistance, feel free to ask!
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>)