I am trying to share content from my gallery to the application's accompanying website. Prior to uploading the shared image I would like to display a preview of the image and allow the user to select which user or group they would like the share the image with.
I have been able to load the file to be shared into a webpage locally, however when I try to load the file on my server I see the following errors in my logcat console:
"Mixed Content: The page at 'https://dev2.app.mycompany.com/system/dev/share_test.php' was loaded over HTTPS, but requested an insecure image 'myscheme://sdcard/Android/data/com.mycompany.myapp/files/Pictures/Bow2.jpg'. This content should also be served over HTTPS.", source: https://dev2.app.mycompany.com/system/dev/share_test.php (25)
"Not allowed to load local resource: content://com.mycompany.myapp/sdcard/Android/data/files/Pictures/Bow2.jpg", source: https://dev2.app.mycompany.com/system/dev/share_test.php (32)
My webview has the following settings enabled:
mWebSettings.setSupportZoom(false);
mWebSettings.setJavaScriptEnabled(true);
mWebSettings.setAllowFileAccess(true);
mWebSettings.setAllowFileAccessFromFileURLs(true);
mWebSettings.setAllowUniversalAccessFromFileURLs(true);
mWebSettings.setAllowContentAccess(true);
Without changing anything I am getting the issue that I am not allowed to load a local resource. On a second attempt I have seen this post suggesting using a custom url scheme which is causing the mixed content issue. That SO post is from 2012 so I'm wondering if security changes in the last 6 years no longer allow local content loaded into a remote website? I've found the following link regarding "Not allowed to load local resource" but there isn't any specific information on Android webviews.