I made an application an year ago and I used this code to download a page to local file and then open it in browser intent:
FileOutputStream fos = openFileOutput("summary.html", Context.MODE_PRIVATE);
fos.write(msg.obj.toString().getBytes());
fos.close();
Intent i = new Intent(Intent.ACTION_VIEW);
i.setDataAndType(Uri.fromFile(getFileStreamPath("summary.html")),"text/html");
startActivity(i);
And it worked at the time. Now I had to pick up the application again and this no longer works.
In the browser intent window I get a
Web Page not available
The webpage at file://…. could not be loaded (etc etc)
I’m still running with the same android version I did in the beginning (2.1), so it’s not related to the deployed OS version. But the SDK has been updated since then, maybe something changed?
If I switch from MODE_PRIVATE to MODE_WORLD_READABLE it works, but doesn’t the intent run with same userid as calling application?
Any option on how to do this and keep the file in MODE_PRIVATE?
And any information on what might have changed for this to happen? I have googled and found nothing…
I find that very difficult to believe.
No, apps have always run in their own process, with their own user ID, and therefore no other apps can access your
MODE_PRIVATEfiles.No, for any likely definition of your phrase “intent run”. Each app runs in its own process, under its own user ID.
Display it yourself in a
WebView.