I have one hi-bride application in which there is a file collector on one html page and I want to load this page in an Android web browser.
These builders work well in the device browser, but not in web browsing.
To support this, I use one hidden WebChromeClient method, which is below
public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType){ /**updated, out of the IF **/ mUploadMessage = uploadMsg; /**updated, out of the IF **/ if(boolFileChooser){ //Take picture from filechooser Intent i = new Intent(Intent.ACTION_GET_CONTENT); i.addCategory(Intent.CATEGORY_OPENABLE); i.setType("image/*"); startActivityForResult( Intent.createChooser( i, "Pick File.." ), FILECHOOSER_RESULTCODE ); } else { //Take photo and upload picture Intent cameraIntent = new Intent("android.media.action.IMAGE_CAPTURE"); photo = new File(Environment.getExternalStorageDirectory(), "Pic.jpg"); if(photo.exists()) photo.delete(); cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photo)); mCapturedImageURI = Uri.fromFile(photo); startActivityForResult(cameraIntent, CAMERAREQUEST_RESULTCODE); } } // Per Android < 3.0 public void openFileChooser(ValueCallback<Uri> uploadMsg){ openFileChooser(uploadMsg, ""); } //Aftre public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType, String capture) { openFileChooser(uploadMsg, ""); }
It worked fine until 4.3, but from 4.4 this method is not called. And they said https://code.google.com/p/android/issues/detail?id=62220 . This has been removed.
Does anyone know some alternative way. Please let me know, your help will be greatly appreciated.
javascript android
Yashdeep patel
source share