2016년 11월 29일 화요일

Webviewer issue with local html files


Hi folks.

I'm developing an app that uses webviewer to view html files located in the assets directory. Initially, it reads html files included as assets in the app apk file. This works fine and the hrml files display fine.

Twice a month, the app runs a check with my web server to download the latest version of these html files. It uses the web component to get the files and store them in the assets folder. This works fine - the files download and are stored in the assets dir.

The new html files can be viewed using the android file manger, which confirms that they're in the assets dir and I cannot see the old ones there (they must be overwritten - which is fine, as I only want one version there at any one time), BUT, and this is the problem, when you load the app and try to view the files through it, it displays the original html files that were packaged with the app and not the new ones downloaded from the server.

I looks like the app or webviewer component is caching the files somehow, but it's not that straightforward as my app runs the download on first run as well (if there's a net connection), so the new html files should be downloaded to the assets dir before the web viewer even opens them for the first time.

Does anyone know what's going on here? I have html meta commands in the html files to try to force no caching etc., but that makes no difference. I'm pulling my hair out here!

Any help would be much appreciated :)

Thank you.

-- 
These are the blocks that locate the html files and display them in the webviewer component.
Capture.PNG 표시 중

-- 
In trying to work out wht's going on, I have found that if I delete the Appinventor dir on the phone or tablet that I'm testing the app on - the folder that contains all of the assets - the app still works fine and displays all of the images, html files etc. that I've deleted! I thought that perhaps the system or app has cached the assessts somewhere else, but I cannot find them. Stranger still, when I uninstall the app on both the phone and tablet, then reinstall, the Appinventor dir is not created. If fact, there's no trace of appinventor assets anywhere on the phone, yet the app still works and all of the assets still display (but not the ones that download from the internet on first run, as per my original problem). Does anyone know what might be going on here?!  

-- 
I have bottomed out the issue. I was mistaking the Companion App dir on both the tablet and phone as being the asset store for the app. That explains why files saved into that dir are not read by the app as assets. Ignore my original questions! :)

-- 

 the files download and are stored in the assets dir.

no, after building your app the assets are read only, you only can download to sdcard!


I looks like the app or webviewer component is caching the files somehow

therefore your app will still access the old files from the assets

Taifun

-- 

댓글 없음:

댓글 쓰기