Guys this thing is driving me crazy.
I have a local HTML file that i want to display inside a webview.
This file is changed dynamically so i cant leave it inside system.ResourceDirectory.
I tested it on phone simulator and everything goes well.
The problem is, when I test it on real phone the webview page doesn’t show. Just a blank scene.
The problem only happened if I place the requested file inside system.TemporaryDirectory or system.CachesDirectory. If I use system.ResourceDirectory the page is displayed correctly.
Here is the code to display it.
local myFilePath = htmlPath print("Requested File: "..myFilePath) local webView = native.newWebView(display.contentCenterX, display.contentCenterY, display.contentWidth, display.contentHeight ) webView:request( myFilePath ) print("LoadedHTML") local file = io.open(myFilePath, 'r') print(file:read( "\*a" )) io.close(file)
As you can see I checked if the file is empty, but that is not the case. (Of course, when I tried it with ResourceDirectory I get an expected error on io.open but the webview is displayed correctly behind the error message)
Do i need special permission or something like that to request page from cache or temp folder?
BTW I am using android 7.0, don’t know if it matters.