Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-28057

Android: Modify WebView to use scoped storage for <input/> file selection

    Details

      Description

      Summary:
      If a webpage displayed by Ti.UI.WebView has an <input type="file"/> element for taking camera photos, then our Android code will save the photo to "public" external storage which is no longer allowed due to Android's "scoped storage" rules. The photo must be saved to a different location.

      Note:
      An example on how to implement file/image selection in HTML can be found here...
      https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file

      To-Do:
      Our TiWebChromeClient.java code needs to replace its usage of the following method call.
      Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES)

      Best solution would be to let the camera app store the photo to its default location and use a ContentResolver to retrieve an InputStream to the photo.

      There is also an Android 11 "package visibility" issue in our TiWebChromeClient.java code where we use the Java resolveActivity() method. We should remove our usage of this method since it will require a <query/> element in the "AndroidManifest.xml" to work. Instead, wrap the startActivityForResult() method call with a try/catch block in case no activity was found.

        Attachments

          Activity

            People

            • Assignee:
              jquick Joshua Quick
              Reporter:
              jquick Joshua Quick
              Reviewer:
              Gary Mathews
              Tester:
              Sohail Saddique
            • Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                  Git Integration