using qpython (python2.x), from what i can see, the way to open a web browser on android from a python script is by first getting the "application uri?" by calling
from androidhelper import Android
droid = Android()
droid.getLaunchableApplications()
where i got "com.google.android.apps.chrome.Main" as my "application uri?" next, i use droid.startActivity() to launch the application. the syntax is as follows.
startActivity(
String action,
String uri[optional],
String type[optional]: MIME type/subtype of the URI,
JSONObject extras[optional]: a Map of extras to add to the Intent,
Boolean wait[optional]: block until the user exits the started activity,
String packagename[optional]: name of package. If used, requires classname to be useful,
String classname[optional]: name of class. If used, requires packagename to be useful)
a working use of this code that i googled is below. it opens up the youtube application and goes to a specific video.
droid.startActivity('android.intent.action.VIEW',
'vnd.youtube:3nH_T9fLd_Q', None, None, False, None, None)
but i cant quite figure out how to turn this code into the code i need. i want to open the file "new.html" (located in the current working directory) and display it in the chrome browser.
sl4a documentation
I tried lots of different ways to do what you want to do:
The best way: intent with category
Make an intent with CATEGORY_BROWSABLE. This should launch an app to browse the HTML; if there are multiple apps, it'll ask the user which to launch.
System browser
Launch the built-in Android system browser.
HTML viewer
Just view, giving no package name and class name. Usually Android will launch the HTML viewer.
Sl4a webViewShow
Use sl4a's
webViewShowdirectly.If you like this answer, remember to upvote or set mine as the answer! Hope this help you!