Path: ...!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Arno Welzel Newsgroups: comp.mobile.android Subject: Re: viewing local htm files on Android device Date: Fri, 26 Jul 2024 17:50:06 +0200 Lines: 54 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: individual.net lVuUJbx0EkBboWClve03WgSOA70CAu3BEtugAbZfFZpVI1evdd Cancel-Lock: sha1:GqYBZuohSReeaA+AGTyhIvpaTUs= sha256:Kiu0bw/AfcqcvRH+DoitxDDKkgZP0qt3Zb3M/ap5+RI= Content-Language: de-DE In-Reply-To: Bytes: 2797 Malone, 2024-07-23 07:31: > > I've created a simple (just text, no script) .htm file on a Windows > computer ("testhtm.htm") and transferred it to my Android tablet. > > In My Files - Downloads it then appears as "testhtm.htm". Tapping it and > it opens with Chrome (my default browser) as > "content:media/external/file/1000000383". > > Long tap and select "Add to Home Screen" and an icon appears on the home > screen titled "testhtm". And when tapping this it opens in Chrome. > > If I now restart (reboot) the tablet and try to open the file by tapping > its icon on the home page it doesn't open and I receive the message: > "Chrome does not have access to the requested resource." > > If I then go to My Files - Downloads I find I can open it from there. > And if I then go back to the home page it will now open from there as well. > > Why is this? I think access to "content:media/external/file/1000000383" is only granted using a temporary access token which gets lost when rebooting the device. I had this issue with my own app when it asked for permission to access files using the Storage Access Framework. Technically it needs to add Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION to the request, so the access token is persistent and survices reboots. Also see here: Quote: "When combined with FLAG_GRANT_READ_URI_PERMISSION and/or FLAG_GRANT_WRITE_URI_PERMISSION, the URI permission grant can be persisted across device reboots until explicitly revoked with Context#revokeUriPermission(Uri, int)." Without this flag, a read permission will be lost after a reboot. So the only real solution to this would be to use a browser which creates a permanent access token when adding the shortcut to the launcher. Maybe it helps when you open it in Chrome first and use Chrome to add the shortcut to the home screen and not the file manager. -- Arno Welzel https://arnowelzel.de