Open a browser

Monkey Targets Forums/Android/Open a browser

Midimaster(Posted 2013) [#1]
I'm am already able to open an browser window and displaying the content of an external URL like "http://www.../manual.html". But is it also possible to open the browser window with html-file, which came with the installation of the game like "manual.html"?


Midimaster(Posted 2013) [#2]
Ok, with the help of guys from the german Blitz forum it is working now:

This is a variantion of diddy's code:
static void launchHtmlFile(String address) {
	android.net.Uri uriUrl = android.net.Uri.parse(address);
	android.content.Intent launchBrowserActivity = new android.content.Intent(android.content.Intent.ACTION_VIEW);
	launchBrowserActivity.setClassName("com.android.browser", "com.android.browser.BrowserActivity"); 
	launchBrowserActivity.setData(uriUrl); 
	BBAndroidGame._androidGame._activity.startActivity(launchBrowserActivity);
}

the difference is, that this code now fixes the browser as the target for "file://*.html" It looks like android does not look at the extension, but only at the prefix.

so now I can call the function with adresses like:

LaunchNativeBrowser("http://www.midimaster.de/temp/Anleitung.html") 
'or 
LaunchNativeBrowser("file://sdcard/testA/Anleitung.html")

* * * EDIT: one day later...* * *
yesterday it worked with prefix "file://", but today not anymore! Why?




But not with:

LaunchNativeBrowser("file://Anleitung.html")
LaunchNativeBrowser("monkey://Anleitung.html")
LaunchNativeBrowser("monkey://data/Anleitung.html")
LaunchNativeBrowser("file://monkey://data/Anleitung.html"
'etc...)


How can I now access files which have been included in the apk?