Objective:
To force Android to open a given URL directly in a chosen, pre-installed web browser application using the ActivityStarter component, bypassing the system’s default browser or the app chooser dialog.
Core Component:
- ActivityStarter: This component is used to launch other Android activities, including specific apps or actions.
Key Properties to Set:
-
Action : android.intent.action.VIEW - This standard Android action indicates the intent is to display data to the user.
-
DataUri : The URL you want to open (e.g., “https://community.androidbuilder.in/”). This should be passed as an input/variable to your procedure.
-
ActivityPackage : The unique identifier for the target browser application. This is different for each browser.
-
ActivityClass : The specific component (Activity) within the browser app that handles the VIEW action for URLs. This is also different for each browser and sometimes crucial for directing the intent correctly.
Prerequisites:
-
The target web browser must be installed on the Android device where the app is running. If the specified browser is not installed, the ActivityStarter call will likely fail.
-
You need an ActivityStarter component added to your Android Builder project.
General Procedure Structure:
Create a procedure (like open_in_browsername) that takes the URL as an input. Inside the procedure, configure the ActivityStarter properties as shown below, then call StartActivity.
Documentation for Specific Browsers:
(Note: Package and Class names can sometimes change between browser versions or variants (e.g., Beta, Nightly). These are the commonly used ones for the stable releases. Always test on target devices.)
1. Google Chrome
ActivityPackage : com.android.chrome
ActivityClass : com.google.android.apps.chrome.Main
2. Microsoft Edge
ActivityPackage : com.microsoft.emmx
ActivityClass : com.microsoft.ruby.Main
3. Mozilla Firefox
ActivityPackage : org.mozilla.firefox
ActivityClass : org.mozilla.gecko.BrowserApp
4. Brave Browser
ActivityPackage : com.brave.browser
ActivityClass : com.google.android.apps.chrome.Main (Note: Brave is Chromium-based and often uses Chrome’s class structure)
5. Opera Browser
ActivityPackage : com.opera.browser
ActivityClass : com.opera.Opera (or sometimes com.opera.android.StartupActivity) - Test which works reliably.
6. DuckDuckGo Privacy Browser
ActivityPackage : com.duckduckgo.mobile.android
ActivityClass : com.duckduckgo.app.browser.BrowserActivity
7. Samsung Internet Browser
ActivityPackage : com.sec.android.app.sbrowser
ActivityClass : com.sec.android.app.sbrowser.SBrowserMainActivity
8. Vivaldi Browser
ActivityPackage : com.vivaldi.browser
ActivityClass : com.vivaldi.browser.BrowserActivity
AIA file
BrwoserTaps.aia (3.1 KB)