I'm trying to start an intent to load a local web page in a browser for Android Lollipop:
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse("file:///android_asset/my_page.html"));
startActivity(i);
Unfortunately, I get that the page can't be found. I later found that the default browser only supports HTTP and HTTPS requests.
Does this mean I have to start a local web server on the user's phone to load my_page.html via a web intent? :/ Such local servers exist at least, but seem too heavyweight for my usage.
I can't use a web view since web views don't let users download object URLs, which my app relies on (I tried writing a DownloadListener
that uses DownloadManager to no avail.).
I could simply host the static page on a remote server, but then my app would be unusable offline ... unless I use App Cache. However, using App Cache is suboptimal since the user's first usage of the app better be when he/she is online ... otherwise, the first load fails.
Any ideas on how to open a local asset page via a web intent?