titanium-sdk
titanium-sdk copied to clipboard
Android Webview android:targetSdkVersion=30+ access local files default changed
With Android SDK Version 30+ by default a webview will not have access to local assets like images accessed through file://.
This is therefore a breaking change since previously the default was for this setting to be true.
Android documentation of the change: https://developer.android.com/reference/android/webkit/WebSettings#setAllowFileAccess(boolean)
Stackoverflow dealing with the problem natively: https://stackoverflow.com/a/63846853/181197
I will submit a PR so that this becomes a property.
To have the hyperloop workaround here too if someone finds this issue:
const WebView = require('android.webkit.WebView');
var webView = new WebView($.www); // convert your WebView to a native WebView
console.log(webView.getSettings().getAllowFileAccess()); // false
webView.getSettings().setAllowFileAccess(true);
console.log(webView.getSettings().getAllowFileAccess()); // true
Please see new PR where I have implemented setAllowFileAccess / getAllowFileAccess as a full Android property. Thanks!
Is there any progress here?
Is there any progress here?
Hyperloop doesn’t work in my app so I had to build a custom sdk. That is not optimal for production. But I had no other choice.
Hyperloop doesn’t work in my app so I had to build a custom sdk. That is not optimal for production. But I had no other choice.
How were you to build a custom sdk. I don't know this. are There help videos or documents?
There is just this section here on how to build locally: https://github.com/tidev/titanium_mobile#building-locally But you need to clone the repo and implement this change: https://github.com/tidev/titanium_mobile/pull/13189/files
I've triggered the build again. If it runs successfully you can also download the artifact from there. Otherwise as @Xlinx64 showed. Check https://stackoverflow.com/a/30584951/5193915 how to get a PR.
@Xlinx64 just curious: why didn't hyperloop work for you?
I'll also check the PR and see if it can be merged soon
@m1ga I used hyperloop for some time but after the update to titanium 10 the webview didnt load anymore. I couldnt really figure out why the hyperloop broke it.
A last question: You've added setAllowFileAccess to the SDK, right? One concern in the PR was that Google will eventually flag the app as insecure. Do you have your app in store and did Google complain about it?
@akinsoftyazilim42 you can download a build from https://github.com/tidev/titanium_mobile/actions/runs/2629857662 scroll down and download the zip
I didnt have a problem with this. I already updated the app 2 times in the playstore and there where no complaints from google.