I\'ve made a relatively simple phonegap app, with the ability to capture images and videos and upload them to a server.
Images work fine, however when I call to capt
A workaround for this issue is to edit [yourApp]\plugins\org.apache.cordova.media-capture\src\android\Capture.java
Starting at line 377, change this code
private JSONObject createMediaFile(Uri data) {
File fp = webView.getResourceApi().mapUriToFile(data);
JSONObject obj = new JSONObject();
to the following code
private JSONObject createMediaFile(Uri data) {
// is thread checking enabled?
boolean thC = webView.getResourceApi().isThreadCheckingEnabled();
// set thread checking to disabled (this works around mapUriToFile failing with IllegalStateException: Do not perform IO operations on the UI thread.
webView.getResourceApi().setThreadCheckingEnabled(false);
File fp = webView.getResourceApi().mapUriToFile(data);
// set thread checking back to whatever it was before the call above.
webView.getResourceApi().setThreadCheckingEnabled(thC);
JSONObject obj = new JSONObject();
This worked for us, hopefully it will be fixed properly soon.